Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package newschecksqlserver;
- /**
- *
- * @author Jay Khurana
- */
- import com.mashape.unirest.http.HttpResponse;
- import com.mashape.unirest.http.JsonNode;
- import com.mashape.unirest.http.Unirest;
- import com.mashape.unirest.http.exceptions.UnirestException;
- import java.awt.Color;
- import java.math.BigInteger;
- import java.util.*;
- //TODO import JDBC driver
- import java.net.URI;
- import java.net.URISyntaxException;
- import java.net.URL;
- import java.net.URLConnection;
- import java.net.URLEncoder;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.swing.JOptionPane;
- import javax.swing.table.DefaultTableModel;
- import org.json.JSONArray;
- public class NewsUpdater {
- //TODO add webhose api array and current index, intialize in main
- private static Connection con;
- private static final String [] webhoseTokens = {"f299c8df-c58a-4757-8044-b31313786022"};
- private static int tokenChoice = 0;
- public static void main(String[] args) {
- // TODO code application logic here
- //retrieveAndParseWebhose(0);
- //updateTable(null);
- //runRetrieval();
- try{
- connectToSQL();
- }catch(Exception exe){
- System.out.println("Error Connecting to SQL");
- return;
- }
- /* String query = "INSERT INTO dbo.ARTICLES values('652222dd9e931e304f667d6fbfabe36c023bb18f', 1486284741492, 'go.com' , 72, 0.0, NULL, NULL, 25, NULL)";
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(query);
- }catch(Exception exe){
- System.out.println();
- }*/
- /*
- // INITIAL CODE I RAN TO SET UP THE TABLES IN THE DATABASES
- try{
- createArticlesTable();
- }catch(Exception exe){
- System.out.println("Error creating SQL table");
- return;
- }
- try{
- createLookupTable();
- }catch(Exception exe){
- System.out.println("Error creating SQL table");
- return;
- } */
- long round = 0;
- while(true){
- System.out.println("Scraping round "+ round++);
- long unixTime = System.currentTimeMillis();
- retrieveAndParseWebhose(unixTime-1000*300); //TODO ERROR CHECK
- try {
- Thread.sleep(1000*5*60);
- } catch (InterruptedException ex) {
- Logger.getLogger(NewsUpdater.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- /**
- * Queries webhose every 5 minutes to get latest news updates
- */
- private static void runRetrieval(){
- //WHILE TRUE:
- //call retrieveAndParseWebhose(TS);
- //start new thread for processing webhose query
- //sleep 5 minutes
- }
- /**
- * Retrieves all news data after a given unix timestamp
- * @param timestamp
- * @return a List of List of Strings to be added to the SQL table
- */
- private static void retrieveAndParseWebhose(long timestamp){
- String token = webhoseTokens[tokenChoice++];
- tokenChoice = tokenChoice % webhoseTokens.length;
- String request = "http://webhose.io/search?token="+token+"&format=json&q=%20language%3A(english)%20(site_type%3Anews)%20domain_rank%3A%3C100&ts="+timestamp;
- try{
- //String link = "http://webhose.io/search?token=f299c8df-c58a-4757-8044-b31313786022&format=json&q=language%3A(english)%20(site_type%3Anews)%20domain_rank%3A%3C100&ts=1486263054470";
- HttpResponse<JsonNode> response = Unirest.get(request).header("Accept", "text/plain").asJson();
- System.out.println();
- AsyncProc async = new AsyncProc(response);
- async.run();
- }catch(UnirestException exe){
- exe.printStackTrace();
- System.out.println("Exception occured while parsing shit\n");
- }catch(Exception exe){
- exe.printStackTrace();
- System.out.println();
- }
- }
- public static void updateTables(List<List<Object>> cells){
- String connectionUrl = "jdbc:sqlserver://newzcheck.cnvyumwrcz7i.us-east-1.rds.amazonaws.com:1433;"
- + "databaseName=verifiednews;user=allAccess;password=xFz23d4a3Ln5dZ5sW";
- try {
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- Connection con = DriverManager.getConnection(connectionUrl);
- String sqlQuery = "SELECT CURRENT_VER, VER_URL "
- + "FROM dbo.UPDATES";
- Statement stmt;
- ResultSet rs;
- try {
- stmt = con.createStatement();
- rs = stmt.executeQuery(sqlQuery);
- rs.next();
- String verCheck = rs.getString(1);
- System.out.println("Check passed: " + verCheck);
- } catch (Exception exe) {
- System.out.println("Check failed");
- }
- con.close();
- } catch (ClassNotFoundException exe) {
- System.out.println("SQL Driver missing");
- } catch (Exception exe) {
- exe.printStackTrace();
- System.out.println("Other exception");
- }
- }
- //TODO: SEPERATE CLASS THAT RUNS OTHER SHIT
- //TODO: Asynchronous calls
- private static void connectToSQL() throws Exception{
- String connectionUrl = "jdbc:sqlserver://newzcheck.database.windows.net:1433;database=verifiednews;user=allAccess@newzcheck;password={xFz23d4a3Ln5dZ5sW};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30";
- /*String connectionUrl = "jdbc:sqlserver:/newzcheck.database.windows.net:1433;"
- + "databaseName=verifiednews;user=allAccess;password=xFz23d4a3Ln5dZ5sW"; */
- //String connectionUrl="jdbc:sqlserver://localhost:1433;"
- // + "databaseName=Genes;user=sa;password=12345";
- try{
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- con = DriverManager.getConnection(connectionUrl);
- }catch(ClassNotFoundException | SQLException exe){
- throw exe;
- }
- }
- //Retrieves data from SQL
- private static void retrieveDataFromSQL() throws Exception{
- /*
- String sqlQuery="SELECT PROT_FASTA, NUCLEO_FASTA, "
- + "PARA_PROT_ALI, PARA_NUCLEO_ALI, HOMO_PROT_ALI, "
- + "HOMO_NUCLEO_ALI FROM dbo." +gene.toUpperCase().replace("-", "") +" ORDER BY PRIM_KEY";
- Statement stmt;
- ResultSet rs;
- stmt=con.createStatement();
- rs=stmt.executeQuery(sqlQuery);
- String protFasta=null, nucleoFasta=null, nID=null, pID=null;
- try{
- rs.next();
- protFasta=rs.getString(1);
- nucleoFasta=rs.getString(2);
- aFasta=protFasta.substring(protFasta.indexOf("\n")+1,protFasta.length()-1);
- tempDNA=nucleoFasta.substring(nucleoFasta.indexOf("\n")+1,nucleoFasta.length()-1);
- pFasta2=rs.getString(3);
- nFasta2=rs.getString(4);
- pFasta=rs.getString(5);
- nFasta=rs.getString(6);
- if(pFasta==null||pFasta.equals("")){
- if(b!=null)
- b.addError(gene.toUpperCase()+" has neither orthologous or "
- + "paralogous genes that could be found. "
- + "The nucleotide and protein sequences and other "
- + "gene information is still availible, however.");
- else
- JOptionPane.showMessageDialog(null, gene.toUpperCase()+" has neither orthologous or "
- + "paralogous genes that could be found. "
- + "The nucleotide and protein sequences and other "
- + "gene information is still availible, however.",
- "Warning", JOptionPane.WARNING_MESSAGE);
- }
- sqlQuery="SELECT GENE_PROPS FROM dbo." + gene.toUpperCase().replace("-", "") +
- " ORDER BY PRIM_KEY";
- rs=stmt.executeQuery(sqlQuery);
- geneProperties[0]=gene;
- for(int i=1; i<9; i++){
- rs.next();
- geneProperties[i]=rs.getString(1);
- }
- gene1=new Gene(gene,geneProperties[4],geneProperties[5],nucleoFasta,protFasta);
- model=(DefaultTableModel)table.getModel();
- tempSNPs=new SNP[5000];
- sqlQuery="SELECT SNP, SNP_PHENO, SNP_MULT, SNP_URL "
- + "FROM dbo." + gene.toUpperCase().replace("-", "") +
- " ORDER BY PRIM_KEY";
- rs=stmt.executeQuery(sqlQuery);
- while(rs.next()){
- String SNPID=rs.getString(1);
- String SNPPheno=rs.getString(2);
- String SNPMult=rs.getString(3);
- String SNPURL=rs.getString(4);
- if(SNPID==null)
- continue;
- if(SNPPheno==null)
- SNPPheno="Unknown";
- if(SNPMult==null)
- SNPMult="Not verified";
- try{
- SNP s = new SNP(SNPPheno, SNPID.substring(SNPID.length()-1, SNPID.length()),
- "",Integer.parseInt(SNPID.substring(1,SNPID.length()-1)),
- -1, false);
- s.setInfoURL(SNPURL);
- if(b==null)
- model.addRow(new Object[]{
- true,SNPID,SNPPheno,SNPMult,"Please Wait"});
- else
- model.addRow(new Object[]{
- false,SNPID,SNPPheno,SNPMult,"Please Wait"});
- tempSNPs[numClinicalSNPs++]=s;
- rowURL[numClinicalSNPs-1]=tempSNPs[numClinicalSNPs-1].getInfoUrl();
- }catch(NumberFormatException exe){
- continue;
- }
- }
- allSNPs = new SNP[5000];
- System.arraycopy(tempSNPs, 0, allSNPs, 0, numClinicalSNPs);
- geneURL=geneSearchURL=geneProperties[6];
- numHomologs=Integer.parseInt(geneProperties[7]);
- numParalogs=Integer.parseInt(geneProperties[8]);
- panel.setLabels(gene,geneProperties[1],""+geneProperties[2],
- geneProperties[3],geneProperties[4],geneProperties[5]);
- panel.enableGeneSequences();
- panel.infoReady();
- panel.enableParalogs();
- panel.stopWait();
- panel.enableMutationChecking();
- panel.stopWait2();
- panel.enableReport();
- panel.enableHomologs();
- }catch(SQLException | NumberFormatException exe){
- System.out.println("Gene read error "+gene);
- clearAll();
- throw exe;
- }finally{
- if(rs!=null)
- rs.close();
- stmt.close();
- }
- */
- }
- //TODO CLOSE CONNECTION ON ERROR
- private static void createArticlesTable() throws Exception{
- String tableName = "ARTICLES";
- String cols =
- "CREATE TABLE dbo." +
- tableName +
- " ("+"UUID nchar(40) NOT NULL, " +
- "TS nvarchar(MAX), " +
- "SITE nvarchar(MAX), " +
- "TITLE nvarchar(MAX), " +
- "DOM_RANK int, " +
- "SPAM_SCORE float(4), " +
- "TEXT nvarchar(MAX), " +
- "COG_RESULTS nvarchar(MAX), " +
- "NUM_KEYWORDS tinyint, " +
- "MISC nvarchar(MAX), " +
- "PRIMARY KEY (UUID))";
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(cols);
- }catch(Exception exe){
- exe.printStackTrace();
- throw exe;
- }
- System.out.println("Table Created Sucesfully!");
- }
- private static void createLookupTable() throws Exception{
- String tableName = "LOOKUP";
- String cols =
- "CREATE TABLE dbo." +
- tableName +
- " ("+"HASH nchar(44) NOT NULL, " +
- "UUID nchar(40), " +
- "TS nvarchar(MAX), " +
- "WORD nvarchar(MAX), " +
- "PRIMARY KEY (HASH))";
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(cols);
- }catch(Exception exe){
- exe.printStackTrace();
- throw exe;
- }
- }
- public Object nullFix(Object o){
- try{
- return ((String)o.equals("")) ? "NULL", o;
- }catch(Exception exe){
- return o;
- }
- }
- public List<Object> nullFixRow(List<Object> objs) {
- List<Object> row = new ArrayList<>();
- for (int i = 0; i < objs.length(); i++) {
- row.add(nullFix(objs.get(i)));
- }
- return row;
- }
- public void setPreparedStatementValue(PreparedStatement p, int col, String type, Object value) {
- if value.equals("NULL") {
- if type.toLower().equals("string") {
- p.setNull(col, java.sql.Types.VARCHAR);
- }
- else if type.toLower().equals("int") {
- p.setNull(col, java.sql.Types.INTEGER);
- }
- else if type.toLower().equals("float") {
- p.setNull(col, java.sql.Types.FLOAT);
- }
- else {
- throw new Exception("Prepared statement null type not handled failure.");
- }
- }
- else {
- if type.toLower().equals("string") {
- p.setString(col, (String)value);
- }
- else if type.toLower().equals("int") {
- p.setInteger(col, (int)value);
- }
- else if type.toLower().equals("float") {
- p.setFloat(col, (float)value);
- }
- else {
- throw new Exception("Prepared statement type not handled failure.");
- }
- }
- }
- public static void saveArticleToSQL(List<Object> articleInfo) {
- //0: UUID, 1: url, 2: publish_time
- List<Object> articleData = nullFixRow(articleInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Article VALUES (?, ?, ?, ?, ?, ? ,? ,? ,? ,? ,? ,? , ? ,? ,? ,?)");){
- for (int i = 0; i < 16 ; i++) {
- if (i < 2) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)articleData.get(i));
- }
- else if (i < 5) {
- setPreparedStatementValue(preparedStatement, i, "int", (int)articleData.get(i));
- }
- else if (i < 12) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)articleData.get(i));
- }
- else if (i < 13) {
- setPreparedStatementValue(preparedStatement, i, "float", (float)articleData.get(i));
- }
- else {
- setPreparedStatementValue(preparedStatement, i, "string", (String)articleData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void saveOrganizationsToSQL(List<Object> organizationInfo) {
- //0: UUID, 1: url, 2: publish_time
- List<Object> organizationData = nullFixRow(articleInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Organizations VALUES (?, ?, ?)");){
- for (int i = 0; i < 3 ; i++) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)organizationData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void savePeopleToSQL(List<Object> peopleInfo) {
- //0: UUID, 1: url, 2: publish_time
- List<Object> peopleData = nullFixRow(peopleInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.People VALUES (?, ?, ?)");){
- for (int i = 0; i < 3 ; i++) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)peopleData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void savePlacesToSQL(List<Object> placesInfo) {
- //0: UUID, 1: url, 2: publish_time
- List<Object> placesData = nullFixRow(placesInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Places VALUES (?, ?, ?)");){
- for (int i = 0; i < 3 ; i++) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)placesData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void saveLinksToSQL(List<Object> linksInfo) {
- List<Object> linksData = nullFixRow(linksInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Links VALUES (?, ?)");){
- for (int i = 0; i < 2 ; i++) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)placesData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void saveCategoriesToSQL(List<Object> categoriesInfo) {
- List<Object> categoriesData = nullFixRow(categoriesInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Categories VALUES (?, ?)");){
- for (int i = 0; i < 2 ; i++) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)placesData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void saveTextToSQL(List<Object> textInfo) {
- List<Object> textData = nullFixRow(textInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Text VALUES (?, ?)");){
- for (int i = 0; i < 2 ; i++) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)placesData.get(i));
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void saveSocialToSQL(List<Object> facebookInfo) {
- List<Object> socialData = nullFixRow(linksInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Links VALUES (?, ?, ?, ?)");){
- for (int i = 0; i < 8 ; i++) {
- if (i < 1) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)socialData.get(i));
- }
- else {
- setPreparedStatementValue(preparedStatement, i, "int", (int)socialData.get(i));
- }
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public static void saveFacebookToSQL(List<Object> facebookInfo) {
- List<Object> facebookData = nullFixRow(linksInfo);
- try (preparedStatement = connection.prepareStatement("INSERT INTO dbo.Links VALUES (?, ?, ?, ?)");){
- for (int i = 0; i < 4 ; i++) {
- if (i < 1) {
- setPreparedStatementValue(preparedStatement, i, "string", (String)socialData.get(i));
- }
- else{
- setPreparedStatementValue(preparedStatement, i, "int", (int)socialData.get(i));
- }
- }
- }
- preparedStatement.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- //Saves data to SQL
- public static void saveDataToSQL(List<List<Object>> cellsAll) throws Exception{
- for(int i=0; i<cellsAll.size(); i++){
- List<Object> cells = cellsAll.get(i);
- String uuid = (String) cells.get(0);
- String dateText = (String)cells.get(1);
- dateText = dateText.substring(0,dateText.lastIndexOf(":")) + dateText.substring(dateText.lastIndexOf(":")+1);
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
- System.out.println("Date correctly formatted");
- Date date = dateFormat.parse(dateText);
- long time = (long) date.getTime();
- BigInteger bi = BigInteger.valueOf(time);
- List<String> keywords = (List<String>) cells.get(6);
- //get timestamp
- //INSERT INTO dbo.ARTICLES values('9', 'b4093de9e2770b045448cf7e97ee1b67629e4770', '1486284087405', cnn.com, 81, 0.014, NULL, NULL, 31, NULL)
- String query = "INSERT INTO dbo.ARTICLES" +
- " values('"+
- uuid+"', "
- + bi + ", " +
- "'"+cells.get(2)+"' , " +
- "NULL" + ", " +
- cells.get(3)+", " +
- cells.get(4)+", " +
- "NULL" + ", " +
- "NULL"/*keywords.toString()*/ + ", " +
- keywords.size() + ", " +
- "NULL" + ")";
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(query);
- }catch(Exception exe){
- continue;
- }
- for(int j=0; j<keywords.size(); j++){
- String hash = keywords.get(j).length() < 4 ? "" + (int)(Math.random()*1000) + 1000 : keywords.get(j).substring(0,4);
- hash = hash + uuid;
- String query2 = "INSERT INTO dbo.LOOKUP" +
- " values('"+hash+"', " +
- "'"+uuid+"', " +
- time+ ", " +
- "'" + keywords.get(j) + "')";
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(query2);
- }catch(Exception exe){
- continue;
- }
- }
- }
- /*boolean drop=checkSQLForGene();
- String geneName=gene.toUpperCase().replaceAll("-", "");
- if(drop){
- String dropStatement = "DROP TABLE Genes.dbo."+ geneName;
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(dropStatement);
- }catch(SQLException exe){
- throw exe;
- }
- }*/
- /*String geneName = "";
- String cols =
- "CREATE TABLE dbo." +
- geneName +
- " ("+"UID INT NOT NULL, " +
- "TS nvarchar(MAX), " +
- "DOM_RANK nvarchar(MAX), " +
- "SPAM_SCORE nvarchar(150), " +
- "TEXT nvarchar(MAX), " +
- "COG_RESULTS nvarchar(MAX), " +
- "MISC nvarchar(MAX), " +
- "PRIMARY KEY (UID))";
- try (Statement stmt = con.createStatement()) {
- stmt.executeUpdate(cols);
- stmt.executeUpdate(cols);
- String paraProt=pFasta2;
- String paraNucleo=nFasta2;
- String homoProt=pFasta;
- String homoNucleo=nFasta;
- if(paraProt==null)
- paraProt="NULL";
- else
- paraProt="'"+paraProt+"'";
- if(paraNucleo==null)
- paraNucleo="NULL";
- else
- paraNucleo="'"+paraNucleo+"'";
- if(homoProt==null)
- homoNucleo="NULL";
- else
- homoNucleo="'"+homoNucleo+"'";
- if(homoProt==null)
- homoProt="NULL";
- else
- homoProt="'"+homoProt+"'";
- int maxRows=numClinicalSNPs;
- if(numClinicalSNPs<8)
- maxRows=8;
- for(int i=0; i<maxRows;i++){
- String s;
- String geneProp=null;
- if(i<8)
- geneProp=geneProperties[i+1];
- if(geneProp==null)
- geneProp="";
- String SNP, SNPPheno, SNPMult, SNPURL;
- try{
- SNP=aFasta.substring(tempSNPs[i].getProtLoc()-1,
- tempSNPs[i].getProtLoc())+tempSNPs[i].getProtLoc()+
- tempSNPs[i].getProtChange();
- SNPPheno=tempSNPs[i].getPhenotype();
- SNPPheno=SNPPheno.replace("'", "''");
- if(tempSNPs[i].getMultipleConfirmed())
- SNPMult="Multiple Publications";
- else
- SNPMult="Single Publication";
- SNPURL=tempSNPs[i].getInfoUrl();
- SNPURL=SNPURL.replace("'", "''");
- }catch(Exception exe){
- SNP=null;
- SNPPheno=null;
- SNPURL=null; s = "INSERT INTO dbo." +
- geneName+
- " values('"+i+"', '"+gene1.getProtFasta()+"', " +
- "'"+gene1.getFasta()+"', " +
- "'"+geneProp+"', " +
- paraProt+", " +
- paraNucleo+", " +
- homoProt+", " +
- homoNucleo + ", " +
- SNP + ", " +
- SNPPheno + ", " +
- SNPMult + ", " +
- SNPURL+")";
- SNPMult=null;
- }
- if(SNP!=null)
- SNP="'"+SNP+"'";
- if(SNPPheno!=null)
- SNPPheno="'"+SNPPheno+"'";
- if(SNP!=null)
- SNPMult="'"+SNPMult+"'";
- if(SNPURL!=null)
- SNPURL="'"+SNPURL+"'";
- if(i==0)
- else if(i<9)
- s = "INSERT INTO dbo." +
- geneName +
- " values('"+i+"', NULL, " +
- "NULL, " +
- "'"+geneProp+"', " +
- "NULL, " +
- "NULL, " +
- "NULL, " +
- "NULL," +
- SNP + ", " +
- SNPPheno + ", " +
- SNPMult + ", " +
- SNPURL+")";
- else
- s = "INSERT INTO dbo." +
- geneName +
- " values('"+i+"', NULL, " +
- "NULL, " +
- "NULL, " +
- "NULL, " +
- "NULL, " +
- "NULL, " +
- "NULL," +
- SNP + ", " +
- SNPPheno + ", " +
- SNPMult + ", " +
- SNPURL+")";
- stmt.executeUpdate(s);
- }
- } catch (Exception exe) {
- System.out.println("Gene write error "+gene);
- exe.printStackTrace();
- throw exe;
- }*/
- }
- //Closes SQL connection
- private static void closeSQL() throws SQLException{
- if(con!=null)
- con.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement