|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.mortbay.JDBC.Database
JDBC Database wrapper This class wraps the detail of creating JDBC drivers and connections to a particular database.
This class takes a DbAdaptor instance, a JDBC database URL and an optional properties object and manages a pool of JDBC connections to that database.
The DbAdaptor instance is used to handle table creation from meta data and formatting values for the particular underlying database.
| Constructor Summary | |
Database()
Default Constructor. |
|
Database(java.util.Hashtable properties)
Database constructor |
|
Database(java.lang.String dbAdaptor,
java.lang.String dbUrl)
Database constructor |
|
Database(java.lang.String dbAdaptor,
java.lang.String dbUrl,
java.util.Hashtable properties)
Database constructor |
|
| Method Summary | |
DbAdaptor |
getAdaptor()
Get the db adaptor |
java.sql.Connection |
getConnection()
Get a connection Get either a new or recycled connection. |
java.sql.Connection |
getConnection(Transaction t)
Get Transaction connection. |
Transaction |
newTransaction()
Create a new transaction instance |
java.sql.ResultSet |
query(java.lang.String query)
Send an SQL query to the database. |
java.sql.ResultSet |
query(Transaction tx,
java.lang.String query)
Send an SQL query to the database in a transaction. |
java.lang.String |
quote(java.lang.String s)
Quote a string for an SQL statement Prepare a string for inclusion in a SQL clause with the quoting conventions of the underlying database. |
int |
update(java.lang.String update)
Send an update SQL request to the database |
int |
update(Transaction tx,
java.lang.String update)
Send an update SQL request to the database in transaction |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public Database()
public Database(java.util.Hashtable properties)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException
properties - A hashtable of connection properties, which must
at least contain DbAdaptor and DbUrl.
public Database(java.lang.String dbAdaptor,
java.lang.String dbUrl,
java.util.Hashtable properties)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException
dbAdaptor - The full package and class name of the JDBC
DbAdaptor type to use for this database.dbUrl - The url of this databaseproperties - A hashtable of connection properties (or null)
public Database(java.lang.String dbAdaptor,
java.lang.String dbUrl)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException
dbAdaptor - The full package and class name of the JDBC
DbAdaptor type to use for this database.dbUrl - The url of this database| Method Detail |
public DbAdaptor getAdaptor()
public Transaction newTransaction()
throws java.sql.SQLException
public java.sql.Connection getConnection()
throws java.sql.SQLException
public java.sql.Connection getConnection(Transaction t)
throws java.sql.SQLException
t - Transaction or null.
public java.sql.ResultSet query(java.lang.String query)
throws java.sql.SQLException
update - SQL query clause
public java.sql.ResultSet query(Transaction tx,
java.lang.String query)
throws java.sql.SQLException
tx - The transaction object or null if no transactionquery - SQL query clause
public int update(java.lang.String update)
throws java.sql.SQLException
update - SQL update clause
public int update(Transaction tx,
java.lang.String update)
throws java.sql.SQLException
tx - The transaction object or null if no transactionupdate - SQL update stringpublic java.lang.String quote(java.lang.String s)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||