|
© 2002 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bea.p13n.util.jdbc.DatabaseFactory
The DatabaseFactory
class provides a means for creating and
returning specific Database
instances relative to the
database being used. This is necessary for CLOB column processing. There
are many different ways JDBC driver vendors choose to implement CLOB
handling, thus the need for driver-specific Database
objects
to handle CLOBs appropriately.
A java.sql.Connection
object is passed in and the java.sql.DatabaseMetaData
for that object
is used to determine which database driver is responsible for creating
the connection. A driver-specific Database
instance will then be returned.
Database
Constructor Summary | |
DatabaseFactory()
|
Method Summary | |
static void |
deregisterDatabase(Database instance)
Remove Database instance from the list of registered instances |
static java.sql.Connection |
getConnection(javax.sql.DataSource src,
int retries)
Get a connection from a DataSource with retry logic. |
static java.sql.Connection |
getConnection(javax.sql.DataSource src,
int retries,
long waitTime)
Get a connection from a DataSource with retry and timeout logic. |
static Database |
getInstance(java.sql.Connection connection)
Get the driver-specific Database instance |
static void |
registerDatabase(Database instance)
Add Database instance to the list of registered instances |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public DatabaseFactory()
Method Detail |
public static Database getInstance(java.sql.Connection connection) throws java.sql.SQLException
connection
- java.sql.Connection objectpublic static java.sql.Connection getConnection(javax.sql.DataSource src, int retries, long waitTime) throws java.sql.SQLException
This will retry upto maxRetries. Additionally, it will only retry for waitTime number of milliseconds (as best as possible -- it might be longer, but will not be less).
This will always try at least once to get a connection. Use retries=0 for only a single attempt.
This works with both transactional and non-transaction DataSources tied to WLS connection pools. In WLS, transactional DataSources always internally wait 5 seconds for a new connection; non-transaction DataSources don't wait at all.
NOTE: The connection pool referenced by the given DataSource needs to be configured with the testConnOnReserve property set to true. This is necessary to ensure that in the event a SQLException is thrown, the cause of the exception is the unavailability of a pooled connection.
The values for maxRetries and maxWaitTime default to -1 (meaning unlimited retries and infinite wait time). These can be configured via the System Properties max.retries and max.wait.
src
- the data source.retries
- the maximum number of times to retry (cannot
exceed maxRetries).waitTime
- the maximum number of milliseconds to try (cannot
exceed maxWaitTime).public static java.sql.Connection getConnection(javax.sql.DataSource src, int retries) throws java.sql.SQLException
src
- the data source.retries
- the maximum number of times to retry (cannot
exceed maxRetries).public static void registerDatabase(Database instance)
instance
- The Database instancepublic static void deregisterDatabase(Database instance)
instance
- The Database instance
|
© 2002 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |