DatabaseFactory Class

com.bea.p13n.util.jdbc
DatabaseFactory Class

public class DatabaseFactory

    extends Object

The DatabaseFactory class provides a means for creating and returning specific Database instances relative to the database being used. This is necessary for CLOB and BLOB column processing. There are many different ways JDBC driver vendors choose to implement CLOB and BLOB handling. Here we address the need for driver-specific Database objects and attempt to handle them 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.

Related Topics

Database


Hierarchy
Object
  DatabaseFactory

Constructor Summary

DatabaseFactory()

 

Method Summary

public static void
deregisterDatabase(Database instance)
Remove Database instance from the list of registered instances.
public static Connection
getConnection(DataSource src, int retries, long waitTime)
Get a connection from a DataSource.
public static Connection
getConnection(DataSource src, int retries)
Get a connection from a DataSource.
public static Database
getInstance(Connection connection)
Get the driver-specific Database instance.
public static void
registerDatabase(Database instance)
Add Database instance to the list of registered instances.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   

Constructor Detail

DatabaseFactory

public DatabaseFactory()
 

Method Detail

deregisterDatabase(Database) Method

DEPRECATED In order to improve performance, dynamically registering/deregistering of databases with the DatabaseFactory is no longer supported. To change the list of supported databases you must modify database-registry.properties and restart your server.

public static void deregisterDatabase(Database instance)
Remove Database instance from the list of registered instances.

Parameters

instance
The Database instance.

getConnection(DataSource, int, long) Method

DEPRECATED Use DataSource.getConnection(), set retries and waitTime by configuring the Pool

public static Connection getConnection(DataSource src, 
                                       int retries, 
                                       long waitTime)
throws SQLException
Get a connection from a DataSource.

This method no longer honors the retry parameter; it will use the 'Connection Reserve Timeout' parameter set on the JdbcConnectionPool via the WLS console.

Parameters

src
The DataSource.
retries
No longer used - the settings on the pool are now used
waitTime
No longer used - the settings on the pool are now used

Returns

A Connection from the DataSource on success.

Exceptions

SQLException
Thrown when trying to get a connection.

getConnection(DataSource, int) Method

DEPRECATED Use DataSource.getConnection(), set retries by configuring the Pool

public static Connection getConnection(DataSource src, 
                                       int retries)
throws SQLException
Get a connection from a DataSource.

This method no longer honors the retry parameter; it will use the 'Connection Reserve Timeout' parameter set on the JdbcConnectionPool via the WLS console.

Parameters

src
The DataSource.
retries
No longer used - the settings on the pool are now used

Returns

A Connection from the DataSource on success.

Exceptions

SQLException
Thrown on an error when getting a connection.

getInstance(Connection) Method

public static Database getInstance(Connection connection)
throws SQLException
Get the driver-specific Database instance.

Parameters

connection
A java.sql.Connection object.

Returns

The driver-specific Database instance.

Exceptions

SQLException
Cannot create or cannot find Database instance for the connection.

registerDatabase(Database) Method

DEPRECATED In order to improve performance, dynamically registering/deregistering of databases with the DatabaseFactory is no longer supported. To change the list of supported databases you must modify database-registry.properties and restart your server.

public static void registerDatabase(Database instance)
Add Database instance to the list of registered instances.

Parameters

instance
The Database instance.