|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgriffon.plugins.hibernate3.internal.JdbcUtils
public abstract class JdbcUtils extends Object
Generic utility methods for working with JDBC.
Contains code from Spring's org.springframework.jdbc.support.JdbcUtils.
Original author Thomas Risberg| Field Summary | |
|---|---|
private static org.slf4j.Logger |
LOG
|
| Constructor Summary | |
JdbcUtils()
|
|
| Method Summary | |
|---|---|
static void
|
closeConnection(Connection con)
Close the given JDBC Connection and ignore any thrown exception. |
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 Object
|
extractDatabaseMetaData(DataSource dataSource, DatabaseMetaDataCallback action)
Extract database meta data via the given DatabaseMetaDataCallback. |
static Object
|
extractDatabaseMetaData(DataSource dataSource, String metaDataMethodName)
Call the specified method on DatabaseMetaData for the given DataSource, and extract the invocation result. |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private static final org.slf4j.Logger LOG
| Constructor Detail |
|---|
JdbcUtils()
| Method Detail |
|---|
public static void closeConnection(Connection con)
con - the JDBC Connection to close (may be null)
public static void closeResultSet(ResultSet rs)
rs - the JDBC ResultSet to close (may be null)
public static void closeStatement(Statement stmt)
stmt - the JDBC Statement to close (may be null)
public static Object extractDatabaseMetaData(DataSource dataSource, DatabaseMetaDataCallback action)
This method will open a connection to the database and retrieve the database metadata. Since this method is called before the exception translation feature is configured for a datasource, this method can not rely on the SQLException translation functionality.
Any exceptions will be wrapped in a MetaDataAccessException. This is a checked exception and any calling code should catch and handle this exception. You can just log the error and hope for the best, but there is probably a more serious error that will reappear when you try to access the database again.
dataSource - the DataSource to extract metadata foraction - callback that will do the actual workprocessMetaData method
public static Object extractDatabaseMetaData(DataSource dataSource, String metaDataMethodName)
dataSource - the DataSource to extract meta data formetaDataMethodName - the name of the DatabaseMetaData method to call
Groovy Documentation