public class DatabaseConnection extends Object
| Constructor and Description |
|---|
DatabaseConnection(Connection conn)
Use the
Configuration passed in to immediately connect to a
database. |
| Modifier and Type | Method and Description |
|---|---|
void |
commit()
commit transaction.
|
void |
dispose()
Closes the internal
Connection. |
Connection |
getConnection()
Get the internal JDBC connection.
|
CallableStatement |
prepareCall(String sql,
List<SQLParam> params)
Indirect call of prepareCall statement with mapped callable statement
parameters.
|
PreparedStatement |
prepareStatement(DatabaseQueryBuilder query)
Indirect call of prepare statement using the query builder object.
|
PreparedStatement |
prepareStatement(String sql,
List<SQLParam> params)
Indirect call of prepare statement with mapped prepare statement
parameters.
|
void |
setConnection(Connection connection)
Get the internal JDBC connection.
|
void |
test()
Determines if the underlying JDBC
Connection is valid. |
public DatabaseConnection(Connection conn)
Configuration passed in to immediately connect to a
database. If the Connection fails a RuntimeException will
be thrown.conn - a connectionRuntimeException - if there is a problem creating a Connection.public void dispose()
Connection.public void test()
Connection is valid.RuntimeException - if the underlying JDBC Connection is not
valid otherwise do nothing.public Connection getConnection()
public void setConnection(Connection connection)
connection - new connectionpublic PreparedStatement prepareStatement(String sql, List<SQLParam> params) throws SQLException
sql - a String sql statement definitionparams - the bind parameter valuesSQLException - an exception in statementpublic PreparedStatement prepareStatement(DatabaseQueryBuilder query) throws SQLException
query - DatabaseQueryBuilder querySQLException - an exception in statementpublic CallableStatement prepareCall(String sql, List<SQLParam> params) throws SQLException
sql - a String sql statement definitionparams - the bind parameter valuesSQLException - an exception in statementpublic void commit()
Copyright © 2018–2025. All rights reserved.