|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectgov.usda.gdpc.AbstractDBConnection
gov.usda.gdpc.database.AbstractJDBCConnection
This class provides a skeletal implementation of the DBConnection
interface which should be used as a connection to a database via JDBC.
To implement a jdbc database connection, the programmer needs to extend
this class and provide implementations for the following methods defined
in the DBConnection interface:
| Field Summary | |
protected java.sql.Connection |
myConnection
The handle to the connection |
protected java.lang.String |
myDriver
The jdbc driver |
protected char[] |
myPassword
The user's password |
protected java.lang.String |
myUID
The database user on whose behalf the connection is being made |
protected java.lang.String |
myURL
The database url of the form jdbc:subprotocol:subname |
| Fields inherited from class gov.usda.gdpc.AbstractDBConnection |
myDataSource, myDescription |
| Constructor Summary | |
AbstractJDBCConnection(java.lang.String dataSource,
java.lang.String description,
java.lang.String driver,
java.lang.String url,
java.lang.String uid,
char[] passwd)
AbstractJDBCConnection Constructor. |
|
AbstractJDBCConnection(java.lang.String dataSource,
java.lang.String description,
java.lang.String driver,
java.lang.String url,
java.lang.String uid,
java.lang.String passwd)
AbstractJDBCConnection Constructor. |
|
| Method Summary | |
void |
close()
Close the database connection. |
boolean |
equals(java.lang.Object obj)
This determines if two database connections are equal. |
protected java.sql.ResultSet |
executeQuery(java.lang.String statement)
This executes the specified select statement. |
protected java.sql.ResultSet |
executeQueryNoScroll(java.lang.String statement)
|
java.lang.String |
getDriver()
Returns the jdbc driver. |
static java.lang.String |
getInString(int[] list)
This returns a string generated from the specified list intended to be used in a SQL statement. |
static java.lang.String |
getInString(java.lang.Object[] list)
This returns a string generated from the specified list intended to be used in a SQL statement. |
static java.lang.String |
getInStringWithQuotes(java.lang.Object[] list)
This returns a string generated from the specified list intended to be used in a SQL statement. |
static java.lang.String[] |
getMultiInStringWithQuotes(java.lang.Object[] list,
int max)
This returns an array of strings generated from the specified list intended to be used in a SQL statement. |
java.lang.String |
getUID()
Returns the database user on whose behalf the connection is being made. |
java.lang.String |
getURL()
Returns the database url of the form jdbc:subprotocol:subname. |
protected boolean |
isClosed()
This returns whether database connection is closed. |
protected void |
makeConnection()
Make connection to database. |
| Methods inherited from class gov.usda.gdpc.AbstractDBConnection |
getDataSource, getDescription, getDistinctProperties, getEnvironmentExperimentGroup, getGenotypeExperimentGroup, getGenotypeGenericTable, getGenotypeGroup, getLocalityGroup, getLocusGroup, getPhenotypeGroup, getPhenotypeOntologyGroup, getTaxonGroup, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface gov.usda.gdpc.DBConnection |
getDataSource, getDescription, getDistinctProperties, getEnvironmentExperimentGroup, getGenotypeExperimentGroup, getGenotypeGenericTable, getGenotypeGroup, getLocalityGroup, getLocusGroup, getPhenotypeGroup, getPhenotypeOntologyGroup, getTaxonGroup |
| Field Detail |
protected java.sql.Connection myConnection
protected java.lang.String myDriver
protected java.lang.String myURL
protected java.lang.String myUID
protected char[] myPassword
| Constructor Detail |
public AbstractJDBCConnection(java.lang.String dataSource,
java.lang.String description,
java.lang.String driver,
java.lang.String url,
java.lang.String uid,
java.lang.String passwd)
dataSource - the data source of this connectiondescription - description of the connectiondriver - the jdbc driverurl - a database url of the form jdbc:subprotocol:subnameuid - the database user on whose behalf the connection is being madepasswd - the user's password
public AbstractJDBCConnection(java.lang.String dataSource,
java.lang.String description,
java.lang.String driver,
java.lang.String url,
java.lang.String uid,
char[] passwd)
dataSource - the data source of this connectiondescription - description of the connectiondriver - the jdbc driverurl - a database url of the form jdbc:subprotocol:subnameuid - the database user on whose behalf the connection is being madepasswd - the user's password| Method Detail |
protected void makeConnection()
protected boolean isClosed()
public void close()
close in interface DBConnectionclose in class AbstractDBConnectionpublic static java.lang.String getInStringWithQuotes(java.lang.Object[] list)
list - the list to include
public static java.lang.String[] getMultiInStringWithQuotes(java.lang.Object[] list,
int max)
list - the list to includemax - the maximum number in each generated list
public static java.lang.String getInString(java.lang.Object[] list)
list - the list to include
public static java.lang.String getInString(int[] list)
list - the list to include
protected java.sql.ResultSet executeQuery(java.lang.String statement)
throws java.sql.SQLException
statement - select statement to execute.
java.sql.SQLException
protected java.sql.ResultSet executeQueryNoScroll(java.lang.String statement)
throws java.sql.SQLException
java.sql.SQLExceptionpublic final java.lang.String getDriver()
public final java.lang.String getURL()
public final java.lang.String getUID()
public boolean equals(java.lang.Object obj)
obj - object to test
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||