org.vectorbase.gdav.DBSQL
Class DBConnection

java.lang.Object
  extended by org.vectorbase.gdav.DBSQL.DBConnection

public class DBConnection
extends java.lang.Object

Connection to gdav via JDBC

Author:
seth.redmond@imperial.ac.uk Seth Redmond

At Riskthis modules is at risk of deletion / significant modification


Constructor Summary
DBConnection(java.lang.String dbString)
          make new connection from "host:port/dbname" string with default user /no password
DBConnection(java.lang.String dbString, java.lang.String user, java.lang.String password)
          make new connection from "host:port/dbname" string with explicit user / password
 
Method Summary
 int countSearchAll(java.lang.String search)
          count results for all fulltext fields in all models
 java.sql.ResultSet getAlignsForModel(int model_id)
          get all alignments in db for one model
 java.sql.ResultSet getAllModels()
          get all models in db
 java.sql.ResultSet getAllSubs()
          get all annotation submissions covered in db
 java.sql.ResultSet getAnnoForModelAndSub(int model_id, int submission_id)
          get all records in db for one model and one submission
 java.sql.ResultSet getModelByID(int modelID)
          get one model in db
 java.sql.ResultSet getModelByName(java.lang.String model_name)
          get (hopefully one) model in db by name
 java.sql.ResultSet getModelsByLocation(java.lang.String spp, java.lang.String chr, int start, int end)
          get models in db that *overlap* location
 java.sql.ResultSet getModelsByLocationSpecies(java.lang.String spp, java.lang.String chr, int start, int end, java.lang.String species)
          get models in db that *overlap* location, for a particular model species
 java.sql.ResultSet getModelsBySub(int subID)
          get model by submission_id
 java.sql.ResultSet getModelsWithNameLike(java.lang.String str)
          get models in db matching name
 java.sql.ResultSet getSeqForModel(int model_id)
          get all alignments in db for one model
 java.sql.ResultSet getSubByID(int submissionID)
          get all annotation submissions covered in db
 java.sql.ResultSet getSubsForModel(int model_id)
          get all submissions in db for one model
 java.sql.ResultSet getTitlesForSub(int submission_id)
          get all records in db for one model and one submission
 void ping()
          check if DBconnection has been closed by MySQL server, throw SQLException if closed
 java.sql.ResultSet searchAll(java.lang.String search)
          search all fulltext fields in all models
 void severConnection()
          forcibly close JDBC connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConnection

public DBConnection(java.lang.String dbString)
             throws java.sql.SQLException,
                    java.lang.ClassNotFoundException,
                    java.lang.InstantiationException,
                    java.lang.IllegalAccessException
make new connection from "host:port/dbname" string with default user /no password

Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

DBConnection

public DBConnection(java.lang.String dbString,
                    java.lang.String user,
                    java.lang.String password)
             throws java.sql.SQLException,
                    java.lang.ClassNotFoundException,
                    java.lang.InstantiationException,
                    java.lang.IllegalAccessException
make new connection from "host:port/dbname" string with explicit user / password

Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
Method Detail

severConnection

public void severConnection()
                     throws java.sql.SQLException
forcibly close JDBC connection

Throws:
java.sql.SQLException

getAllSubs

public java.sql.ResultSet getAllSubs()
                              throws java.sql.SQLException
get all annotation submissions covered in db

Throws:
java.sql.SQLException

getSubByID

public java.sql.ResultSet getSubByID(int submissionID)
                              throws java.sql.SQLException
get all annotation submissions covered in db

Throws:
java.sql.SQLException

getAllModels

public java.sql.ResultSet getAllModels()
                                throws java.sql.SQLException
get all models in db

Throws:
java.sql.SQLException

getModelByID

public java.sql.ResultSet getModelByID(int modelID)
                                throws java.sql.SQLException
get one model in db

Throws:
java.sql.SQLException

getModelByName

public java.sql.ResultSet getModelByName(java.lang.String model_name)
                                  throws java.sql.SQLException
get (hopefully one) model in db by name

Throws:
java.sql.SQLException

getModelsWithNameLike

public java.sql.ResultSet getModelsWithNameLike(java.lang.String str)
                                         throws java.sql.SQLException
get models in db matching name

Throws:
java.sql.SQLException

getModelsBySub

public java.sql.ResultSet getModelsBySub(int subID)
                                  throws java.sql.SQLException
get model by submission_id

Throws:
java.sql.SQLException

getModelsByLocation

public java.sql.ResultSet getModelsByLocation(java.lang.String spp,
                                              java.lang.String chr,
                                              int start,
                                              int end)
                                       throws java.sql.SQLException
get models in db that *overlap* location

Throws:
java.sql.SQLException

getModelsByLocationSpecies

public java.sql.ResultSet getModelsByLocationSpecies(java.lang.String spp,
                                                     java.lang.String chr,
                                                     int start,
                                                     int end,
                                                     java.lang.String species)
                                              throws java.sql.SQLException
get models in db that *overlap* location, for a particular model species

Throws:
java.sql.SQLException

searchAll

public java.sql.ResultSet searchAll(java.lang.String search)
                             throws java.sql.SQLException
search all fulltext fields in all models

Throws:
java.sql.SQLException

countSearchAll

public int countSearchAll(java.lang.String search)
                   throws java.sql.SQLException
count results for all fulltext fields in all models

Throws:
java.sql.SQLException

getSubsForModel

public java.sql.ResultSet getSubsForModel(int model_id)
                                   throws java.sql.SQLException
get all submissions in db for one model

Throws:
java.sql.SQLException

getTitlesForSub

public java.sql.ResultSet getTitlesForSub(int submission_id)
                                   throws java.sql.SQLException
get all records in db for one model and one submission

Throws:
java.sql.SQLException

getAnnoForModelAndSub

public java.sql.ResultSet getAnnoForModelAndSub(int model_id,
                                                int submission_id)
                                         throws java.sql.SQLException
get all records in db for one model and one submission

Throws:
java.sql.SQLException

getAlignsForModel

public java.sql.ResultSet getAlignsForModel(int model_id)
                                     throws java.sql.SQLException
get all alignments in db for one model

Throws:
java.sql.SQLException

getSeqForModel

public java.sql.ResultSet getSeqForModel(int model_id)
                                  throws java.sql.SQLException
get all alignments in db for one model

Throws:
java.sql.SQLException

ping

public void ping()
          throws java.sql.SQLException
check if DBconnection has been closed by MySQL server, throw SQLException if closed

Throws:
java.sql.SQLException