|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.jdc.lang.Object
|
+--com.jdc.lang.SerializableObject
|
+--com.jdc.rdb.Database
A default implementation of Database. All application database classes
should subclass this Database class.
Database is defined by its database properties. The
following represent properties of relational databases:
URL).DataSource name, if specified.DatabaseType
class. If not specified, the default type is IBM_DB2. The
URL is derived from the database type and the database name.
A DataSource name may, optionally, be specified to take advantage of connection
pooling. If specified, Username and Password are optional as they may be
specified in the DataSource configuration.
An application database used to store and retrieve data. Database
implements functionality common to all relational databases. However, this class
is based on and has only been tested with the IBM DB2 Universal Database.
For related IBM DB2 documentation, see:
DataSource name is specified, a this class first attempts to obtain
a database Connection from a DataSource. If a
Connection is not obtained, this class then attempts to obtain a
database Connection from the DriverManager.
Note: This class is immutable.
Connection,
DataSource,
Serialized Form| Nested Class Summary | |
class |
Database.DataSource
DataSource represents a DataSource object. |
class |
Database.Version
Version represents the database version number. |
| Field Summary | |
protected Connection |
connection
The database Connection object. |
| Fields inherited from class com.jdc.lang.Object |
string |
| Constructor Summary | |
protected |
Database(String name,
String datasource,
String username,
String password)
Constructs a new Database object for an IBM DB2 database
with the specified database properties. |
| Method Summary | |
boolean |
close()
Closes the database connection, if open. |
boolean |
equals(Object object)
Compares this Database object to the specified object. |
protected void |
finalize()
Closes the database connection, if open, and cleans up system resources. |
String |
getAlias()
Returns the database alias. |
Connection |
getConnection()
Attempts to establish a connection to the database. |
Database.DataSource |
getDataSource()
Returns the database DataSource object for this database
object. |
protected DatabaseMetaData |
getMetaData()
Returns the DatabaseMetaData for this database. |
String |
getName()
Returns the database name. |
DatabaseType |
getType()
Returns the database type. |
String |
getURL()
Returns the database Uniform Resource Locator ( URL). |
protected Database.Version |
getVersion()
Returns the database Version object for this database object. |
int |
hashCode()
Returns a hash code value for this Database object. |
boolean |
open()
Attempts to open a connection to the database. |
String |
toString()
Returns a String representing this Database object. |
| Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Connection connection
Connection object. Once the Database
has been successfully opened, i.e. if (open()), a subclass may reference
this Connection field directly rather than invoking the
getConnection() method.
| Constructor Detail |
protected Database(String name,
String datasource,
String username,
String password)
Database object for an IBM DB2 database
with the specified database properties.
| Method Detail |
public boolean close()
DatabaseConnection are released immediately.
close in interface DatabaseTrue if the database connection is successfully closed. False if the database connection is not successfully closed.public boolean equals(Object object)
Database object to the specified object. Returns
true if the specified object is equivalent to this database object.
equals in class ObjectTrue if a specified object is equal to this database object. False if the specified object is not equal to this database object.hashCode()protected void finalize()
finalize in class Objectpublic String getAlias()
getAlias in interface Databasepublic Connection getConnection()
open() method to
open a database connection. If a connection is already available, this method
returns that database connection.
If available, a connection will be obtained from a DataSource.
Otherwise, a connection will be obtained from the DriverManager.
getConnection in interface DatabaseConnection to the database.public Database.DataSource getDataSource()
DataSource object for this database
object.
DataSource object.protected DatabaseMetaData getMetaData()
DatabaseMetaData for this database. Database
metadata is information about the database.
DatabaseMetaData for this database.public String getName()
getName in interface Databasepublic DatabaseType getType()
getType in interface Databasepublic String getURL()
URL).
URL}).protected Database.Version getVersion()
Version object for this database object.
Version object.public int hashCode()
Database object. This
method is supported for the benefit of hashtables such as those provided
by Hashtable.
hashCode in class Objectequals(java.lang.Object)public boolean open()
DataSource. Otherwise, a connection will
be obtained from the DriverManager.
open in interface DatabaseTrue if a database connection is successfully opened. False if a database connection is not successfully opened.public String toString()
String representing this Database object.
toString in class ObjectString representing this Database object.
|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||