|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jcoderz.commons.util.DbUtil
public final class DbUtil
Utility class for some DB routines.
| Method Summary | |
|---|---|
static void |
close(Connection con)
Close a DB connection according to resource handling idiom. |
static void |
close(ResultSet resultSet)
Close a result set according to resource handling idiom. |
static void |
close(Statement stmt)
Close a statement according to resource handling idiom. |
static PreparedStatement |
getLimitedBatchSizePreparedStatement(PreparedStatement pstmt,
int maxBatchSize)
This method wraps the PreparedStatement given as argument
into a delegate object that calls the executeBatch
method every maxBatchSizeth time a batch is added to
the statement with the addBatch method. |
static void |
registerOracleDriver()
Registers the oracle JDBC driver. |
static void |
setCharOrNull(PreparedStatement pstmt,
int paramIndex,
String value)
Sets a parameter in a PreparedStatement to either a value or null. |
static void |
setClobOrNull(PreparedStatement pstmt,
int paramIndex,
String value)
Sets a parameter in a PreparedStatement to either a value or null. |
static void |
setIntegerOrNull(PreparedStatement pstmt,
int paramIndex,
Integer value)
Sets a parameter in a PreparedStatement to either a value or null. |
static void |
setLongOrNull(PreparedStatement pstmt,
int paramIndex,
Long value)
Sets a parameter in a PreparedStatement to either a value or null. |
static void |
setTimestampOrNull(PreparedStatement pstmt,
int paramIndex,
Timestamp value)
Sets a parameter in a PreparedStatement to either a value or null. |
static void |
setVarcharOrNull(PreparedStatement pstmt,
int paramIndex,
String value)
Sets a parameter in a PreparedStatement to either a value or null. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void close(Statement stmt)
stmt - the statement to be closedpublic static void close(Connection con)
con - the connection to be closedpublic static void close(ResultSet resultSet)
resultSet - the result set to close
public static void setVarcharOrNull(PreparedStatement pstmt,
int paramIndex,
String value)
throws SQLException
pstmt - the prepared statementparamIndex - the parameter index of the parameter to be setvalue - the value to which the parameter must be set
SQLException - if a database access error occurs.
public static void setCharOrNull(PreparedStatement pstmt,
int paramIndex,
String value)
throws SQLException
pstmt - the prepared statementparamIndex - the parameter index of the parameter to be setvalue - the value to which the parameter must be set
SQLException - if a database access error occurs.
public static void setClobOrNull(PreparedStatement pstmt,
int paramIndex,
String value)
throws SQLException
pstmt - the prepared statementparamIndex - the parameter index of the parameter to be setvalue - the value to which the parameter must be set
SQLException - if a database access error occurs.
public static void setTimestampOrNull(PreparedStatement pstmt,
int paramIndex,
Timestamp value)
throws SQLException
pstmt - the prepared statementparamIndex - the parameter index of the parameter to be setvalue - the value to which the parameter must be set
SQLException - if a database access error occurs.
public static void setIntegerOrNull(PreparedStatement pstmt,
int paramIndex,
Integer value)
throws SQLException
pstmt - the prepared statementparamIndex - the parameter index of the parameter to be setvalue - the value to which the parameter must be set
SQLException - if a database access error occurs.
public static void setLongOrNull(PreparedStatement pstmt,
int paramIndex,
Long value)
throws SQLException
pstmt - the prepared statementparamIndex - the parameter index of the parameter to be setvalue - the value to which the parameter must be set
SQLException - if a database access error occurs.public static void registerOracleDriver()
public static PreparedStatement getLimitedBatchSizePreparedStatement(PreparedStatement pstmt,
int maxBatchSize)
PreparedStatement given as argument
into a delegate object that calls the executeBatch
method every maxBatchSizeth time a batch is added to
the statement with the addBatch method.
pstmt - the prepared statement to wrapmaxBatchSize - the maximum batch size at which an executeBatch
should be called
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||