public class JDBCUtil extends Object
| Constructor and Description |
|---|
JDBCUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
bindNTimes(PreparedStatement ps,
int[] values,
int startingBinding)
Bind the passed values to the parameters of the
PreparedStatement, starting at position startBinding |
static String |
convertSQLExceptionToString(SQLException e) |
static String |
generateInBinds(int count)
Generate count '? separated by comma
|
static String |
getNextValSql(Connection conn,
String tableName)
Generate the correct SQL statement to obtain the next value from a sequence/table
generator for the passed table.
|
static void |
safeClose(Connection con) |
static void |
safeClose(Connection conn,
Statement stm,
ResultSet rs) |
static void |
safeClose(InputStream in)
Deprecated.
This should correctly be handled at the place where the stream is about to be closed JBNADM-2600
|
static void |
safeClose(OutputStream out)
Deprecated.
This should correctly be handled at the place where the stream is about to be closed JBNADM-2600
|
static void |
safeClose(Reader reader)
Deprecated.
This should correctly be handled at the place where the stream is about to be closed JBNADM-2600
|
static void |
safeClose(ResultSet rs) |
static void |
safeClose(Statement statement) |
static void |
safeClose(Statement stm,
ResultSet rs) |
static void |
safeClose(Writer writer)
Deprecated.
This should correctly be handled at the place where the stream is about to be closed JBNADM-2600
|
static String |
transformQueryForMultipleInParameters(String query,
String replaceable,
int bindCount)
Populate the passed query with bindCount number of placeholders '?'.
|
public static void safeClose(Connection conn, Statement stm, ResultSet rs)
public static void safeClose(Connection con)
public static void safeClose(ResultSet rs)
public static void safeClose(Statement statement)
public static void bindNTimes(PreparedStatement ps, int[] values, int startingBinding) throws SQLException
PreparedStatement, starting at position startBindingps - PreparedStatement to usevalues - the array of int values to fill instartingBinding - the starting position of the parameter to fill inSQLException - if the Statement.setInt() call failspublic static String transformQueryForMultipleInParameters(String query, String replaceable, int bindCount)
query - the original query including text to replacereplaceable - the part of the original query that should be replaced by '?'s.bindCount - how many placeholders '?' should be generatedpublic static String generateInBinds(int count)
public static String getNextValSql(Connection conn, String tableName)
conn - A valid database connectiontableName - The name of the table to use@Deprecated public static void safeClose(InputStream in)
@Deprecated public static void safeClose(OutputStream out)
@Deprecated public static void safeClose(Reader reader)
@Deprecated public static void safeClose(Writer writer)
public static String convertSQLExceptionToString(SQLException e)
Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.