|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lucene.store.jdbc.datasource.DataSourceUtils
public abstract class DataSourceUtils
A set of Jdbc DataSource utilities.
| Constructor Summary | |
|---|---|
DataSourceUtils()
|
|
| Method Summary | |
|---|---|
static void |
closeResultSet(ResultSet rs)
Close the given JDBC ResultSet and ignore any thrown exception. |
static void |
closeStatement(Statement stmt)
Close the given JDBC Statement and ignore any thrown exception. |
static void |
commitConnectionIfPossible(Connection con)
Commits the connection only if the connection is controlled by us. |
static boolean |
controlConnection(Connection connection)
Returns true if the connection was created by the TransactionAwareDataSourceProxy and it
controls the connection (i.e. it is the most outer connection created). |
static int |
getColumnIndexFromColumnName(ResultSetMetaData metaData,
String columnName)
Returns the column index for the guven column name. |
static Connection |
getConnection(DataSource dataSource)
Returns a jdbc connection, and in case of failure, wraps the sql exception with a Jdbc device exception. |
static Connection |
getTargetConnection(Connection conn)
|
static void |
releaseConnection(Connection con)
Close the given JDBC connection and ignore any thrown exception. |
static void |
rollbackConnectionIfPossible(Connection con)
Tollbacks the connection only if the connection is controlled by us. |
static void |
safeCommitConnectionIfPossible(Connection con)
Same as commitConnectionIfPossible(java.sql.Connection), only does not throw an exception |
static void |
safeRollbackConnectionIfPossible(Connection con)
Same as rollbackConnectionIfPossible(java.sql.Connection), only does not throw an exception. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DataSourceUtils()
| Method Detail |
|---|
public static boolean controlConnection(Connection connection)
true if the connection was created by the TransactionAwareDataSourceProxy and it
controls the connection (i.e. it is the most outer connection created).
public static Connection getConnection(DataSource dataSource)
throws JdbcStoreException
JdbcStoreExceptionpublic static void releaseConnection(Connection con)
TransactionAwareDataSourceProxy, or if it was created
by TransactionAwareDataSourceProxy, and the connection controls the connection
(i.e. it is the most outer connection created).
public static void commitConnectionIfPossible(Connection con)
throws JdbcStoreException
TransactionAwareDataSourceProxy and it is the most outer connection in the tree of connections
the TransactionAwareDataSourceProxy returned.
JdbcStoreExceptionpublic static void safeCommitConnectionIfPossible(Connection con)
commitConnectionIfPossible(java.sql.Connection), only does not throw an exception
public static void rollbackConnectionIfPossible(Connection con)
throws JdbcStoreException
TransactionAwareDataSourceProxy and it is the most outer connection in the tree of connections
the TransactionAwareDataSourceProxy returned.
JdbcStoreExceptionpublic static void safeRollbackConnectionIfPossible(Connection con)
rollbackConnectionIfPossible(java.sql.Connection), only does not throw an exception.
public static void closeStatement(Statement stmt)
stmt - the JDBC Statement to closepublic static void closeResultSet(ResultSet rs)
rs - the JDBC ResultSet to close
public static int getColumnIndexFromColumnName(ResultSetMetaData metaData,
String columnName)
throws SQLException
-1 is returned if none is found.
SQLExceptionpublic static Connection getTargetConnection(Connection conn)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||