public abstract class DatabaseAdaptor
extends java.lang.Object
Constructor and Description |
---|
DatabaseAdaptor() |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
fetchAllSchemas(java.sql.Connection connection)
Fetch all schemas from the connected database
|
java.util.List<java.lang.String> |
fetchNontrivialSchemas(java.sql.Connection connection)
Fetch the list of nontrivial schemas.
|
java.util.List<java.lang.String> |
fetchPrimaryKeys(java.sql.Connection connection,
java.lang.String schema,
java.lang.String table)
Fetch the primary keys for a specified table in a specified schema
|
java.util.List<java.lang.String> |
fetchTables(java.sql.Connection connection,
java.lang.String schema)
Fetch tables for the specified schema
|
abstract java.sql.Array |
getArray(java.lang.String type,
java.sql.Connection connection,
java.lang.Object array)
Get an SQL Array given an SQL array type, connection and a primitive array
|
java.sql.ResultSet |
getColumnsResultSet(java.sql.DatabaseMetaData metaData,
java.lang.String schema,
java.lang.String table)
Get the result set of columns for the specified meta data, schema and table
|
java.sql.Connection |
getConnection(ConnectionDictionary dictionary)
Get a new database connection
|
java.sql.Connection |
getConnection(java.lang.String urlSpec,
java.lang.String user,
java.lang.String password)
Get a new database connection
|
static DatabaseAdaptor |
getInstance()
Get a new database adaptor using the default database adaptor.
|
java.sql.ResultSet |
getPrimaryKeysResultSet(java.sql.DatabaseMetaData metaData,
java.lang.String schema,
java.lang.String table)
Get the result set of primary keys for the specified meta data, schema and table
|
java.sql.ResultSet |
getTablesResultSet(java.sql.DatabaseMetaData metaData,
java.lang.String schema)
Get the result set of tables for the specified meta data and schema
|
java.sql.Blob |
newBlob(java.sql.Connection connection)
Instantiate an empty Blob.
|
public java.sql.Blob newBlob(java.sql.Connection connection)
connection
- the database connectionpublic abstract java.sql.Array getArray(java.lang.String type, java.sql.Connection connection, java.lang.Object array) throws DatabaseException
type
- An SQL array type identifying the type of arrayconnection
- An SQL connectionarray
- The primitive Java arrayDatabaseException
- if a database exception is thrownpublic java.sql.Connection getConnection(java.lang.String urlSpec, java.lang.String user, java.lang.String password) throws DatabaseException
urlSpec
- The URL to which to connectuser
- The user loggin into the databasepassword
- the user's passwordDatabaseException
- if a database exception is thrownpublic java.sql.Connection getConnection(ConnectionDictionary dictionary) throws DatabaseException
dictionary
- A connection dictionaryDatabaseException
- if a database exception is thrownpublic static DatabaseAdaptor getInstance()
public java.util.List<java.lang.String> fetchAllSchemas(java.sql.Connection connection) throws DatabaseException
DatabaseException
gov.sns.tools.database.DatabaseException
- if the schema fetch failspublic java.util.List<java.lang.String> fetchNontrivialSchemas(java.sql.Connection connection) throws DatabaseException
connection
- database connectionDatabaseException
public java.util.List<java.lang.String> fetchTables(java.sql.Connection connection, java.lang.String schema) throws DatabaseException
connection
- The database connectionschema
- The schema for which to fetch the tablesDatabaseException
DatabaseException
- if the schema fetch failspublic java.sql.ResultSet getTablesResultSet(java.sql.DatabaseMetaData metaData, java.lang.String schema) throws java.sql.SQLException
java.sql.SQLException
public java.sql.ResultSet getColumnsResultSet(java.sql.DatabaseMetaData metaData, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
java.sql.SQLException
public java.util.List<java.lang.String> fetchPrimaryKeys(java.sql.Connection connection, java.lang.String schema, java.lang.String table) throws DatabaseException
connection
- The database connectionschema
- The schema to usetable
- The table for which to fetch the primary keysDatabaseException
- Description of the Exceptionpublic java.sql.ResultSet getPrimaryKeysResultSet(java.sql.DatabaseMetaData metaData, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
java.sql.SQLException