Class ConnectionHandlerSupport
- java.lang.Object
-
- com.im.commons.db.util.ConnectionHandlerSupport
-
public final class ConnectionHandlerSupport extends java.lang.Object
Provides methods for gettingConnectionHandler
for JDBC connections maintained by the IJCBaseDataSource
.ConnectionHandler
is a concept from JChem. It's basically a wrapper around a database connection. Its complexity comes from the fact that it can either be given a JDBCConnection
object or it can be given the information for connecting to a database. IJC uses the concept of aDataSource
which providesConnection
objects. TheConnectionHandlerSupport
class bridges these two concepts and allows to createConnectionHandler
instance initialized with aConnection
object obtained from IJCDataSource
. HavingConnectionHanlder
is necessary when calling various JChem APIs.The 'unwrapping' that happens in
ConnectionHandlerSupport
makes sure that the originalConnection
object created by a JDBC driver is extracted from the various wrappers placed around it by theDataSource
implementation and that the createdConnectionHandler
contains this originalConnection
object and not the wrappers.- Author:
- Martin Adamek
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static chemaxon.util.ConnectionHandler
prepareConnectionHandler(javax.sql.DataSource dataSource, java.lang.String jchemPropertiesTableName)
TODO - this javadoc seems wrong.static chemaxon.util.ConnectionHandler
prepareConnectionHandlerMutliConnectionNoTx(javax.sql.DataSource dataSource, java.lang.String schemaPlusProptable)
Special case of creating a ConnectionHandler that only has connection details, not an actual physical connection.static void
releaseConnectionHandler(chemaxon.util.ConnectionHandler ch, javax.sql.DataSource src)
Helper that releases the connection handler.
-
-
-
Method Detail
-
releaseConnectionHandler
public static void releaseConnectionHandler(chemaxon.util.ConnectionHandler ch, javax.sql.DataSource src)
Helper that releases the connection handler. It is just to centralize the processing
-
prepareConnectionHandler
public static chemaxon.util.ConnectionHandler prepareConnectionHandler(javax.sql.DataSource dataSource, java.lang.String jchemPropertiesTableName)
TODO - this javadoc seems wrong. Connection is completely unwrapped? Prepares the ConnectionHandler. It uses Spring DataSourceUtils to obtain the connection, it does not directly pull Connection from the DataSource. In the case that a transaction is active, it wraps the Connection with a proxy that suppresses close() so that accidental call to ConnectionHandler.close() does no damage. UsereleaseConnectionHandler(chemaxon.util.ConnectionHandler, javax.sql.DataSource)
to release resources associated with the ConnectionHandler including the connection
-
prepareConnectionHandlerMutliConnectionNoTx
public static chemaxon.util.ConnectionHandler prepareConnectionHandlerMutliConnectionNoTx(javax.sql.DataSource dataSource, java.lang.String schemaPlusProptable)
Special case of creating a ConnectionHandler that only has connection details, not an actual physical connection. This is useful as it allows JChem to created new connections as it needs so that it can use multiple threads for things like Chemical terms column calculations and table regeneration. WARNING: ConnectionHandler created in this way MUST be closed using ConnectionHandler.close().- Parameters:
dataSource
-schemaPlusProptable
-
-
-