public abstract class JdbcUtil
extends java.lang.Object
Constructor and Description |
---|
JdbcUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(java.lang.AutoCloseable... closeables) |
static void |
commit(java.sql.Connection sqlConnection)
Commit any pending transactions on the Connection.
|
static void |
commit(java.sql.Connection sqlConnection,
AdaptrisMessage msg)
Commit the connection
|
static java.sql.Savepoint |
createSavepoint(java.sql.Connection sqlConnection)
Create a Savepoint on the connection
|
static java.sql.Connection |
getConnection(AdaptrisMessage msg,
AdaptrisConnection adpCon)
Convenience method to get the
Connection either from the
AdaptrisMessage object or from configuration. |
static java.util.Properties |
mergeConnectionProperties(java.util.Properties p,
java.lang.String username,
java.lang.String password) |
static void |
rollback(java.sql.Connection sqlConnection)
Rollback the connection.
|
static void |
rollback(java.sql.Connection sqlConnection,
AdaptrisMessage msg)
Rollback to the stored savepoint.
|
static void |
rollback(java.sql.Savepoint svp,
java.sql.Connection sqlConnection)
Rollback to the stored savepoint.
|
static java.sql.Connection |
testConnection(java.sql.Connection sqlConnection,
java.lang.String testStatement,
boolean debugMode) |
public static void closeQuietly(java.lang.AutoCloseable... closeables)
public static void rollback(java.sql.Savepoint svp, java.sql.Connection sqlConnection)
If Connection.getAutoCommit()
is true, then this operation does nothing.
svp
- the savepoint (if null, no rollback occurs).sqlConnection
- the database connection.public static void rollback(java.sql.Connection sqlConnection)
If Connection.getAutoCommit()
is true, then this operation does nothing.
sqlConnection
- the database connection.public static void commit(java.sql.Connection sqlConnection) throws java.sql.SQLException
If Connection.getAutoCommit()
is true, then this operation does nothing.
sqlConnection
- the SQL Connectionjava.sql.SQLException
- if the commit fails.public static java.sql.Savepoint createSavepoint(java.sql.Connection sqlConnection) throws java.sql.SQLException
If Connection.getAutoCommit()
is true, then this operation returns null.
sqlConnection
- the SQL Connectionjava.sql.SQLException
- if the operation fails.public static java.sql.Connection testConnection(java.sql.Connection sqlConnection, java.lang.String testStatement, boolean debugMode) throws java.sql.SQLException
java.sql.SQLException
public static java.util.Properties mergeConnectionProperties(java.util.Properties p, java.lang.String username, java.lang.String password) throws PasswordException
PasswordException
public static java.sql.Connection getConnection(AdaptrisMessage msg, AdaptrisConnection adpCon) throws java.sql.SQLException
Connection
either from the
AdaptrisMessage
object or from configuration.msg
- the adaptrisMessage objectadpCon
- the configured AdaptrisConnection
java.sql.SQLException
public static void rollback(java.sql.Connection sqlConnection, AdaptrisMessage msg)
If a database connection exists in the AdaptrisMessage object metadata then you don't want to
rollback, you want to let the parent (presumably a
JdbcServiceList
) to do it for you.
sqlConnection
- the database connection.msg
- the AdaptrisMessagepublic static void commit(java.sql.Connection sqlConnection, AdaptrisMessage msg) throws java.sql.SQLException
If a database connection exists in the AdaptrisMessage object metadata then you don't want to
rollback, you want to let the parent (presumably a
JdbcServiceList
) to do it for you.
sqlConnection
- the SQL Connectionmsg
- the AdaptrisMessage currently being processed.java.sql.SQLException
- if the commit fails.