public final class JdbcUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
JdbcUtils.JdbcCallable<T> |
| Constructor and Description |
|---|
JdbcUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeQuietly(Connection connection)
Closes the specified
Connection, swallowing any SQLException. |
static void |
closeQuietly(ResultSet resultSet)
Closes the specified
ResultSet, swallowing any SQLException. |
static void |
closeQuietly(ResultSet resultSet,
Statement statement)
|
static void |
closeQuietly(Statement... statements)
Closes the specified
Statement, swallowing any SQLException. |
static Statement |
createStatement(ImportExportErrorService errorService,
String table,
Connection connection) |
static DatabaseMetaData |
metadata(ImportExportErrorService errorService,
Connection connection) |
static PreparedStatement |
preparedStatement(ImportExportErrorService errorService,
String table,
Connection connection,
String sql) |
static String |
quote(ImportExportErrorService errorService,
String table,
Connection connection,
String identifier)
Quotes the database identifier if needed.
|
static <T> T |
withConnection(ImportExportErrorService errorService,
ConnectionProvider provider,
JdbcUtils.JdbcCallable<T> callable) |
static <T> T |
withNoAutoCommit(ImportExportErrorService errorService,
Connection connection,
JdbcUtils.JdbcCallable<T> callable)
Executes callable with no autoCommit.
|
public static <T> T withConnection(ImportExportErrorService errorService, ConnectionProvider provider, JdbcUtils.JdbcCallable<T> callable)
public static <T> T withNoAutoCommit(ImportExportErrorService errorService, Connection connection, JdbcUtils.JdbcCallable<T> callable)
E.g. PostgreSQL requires autoCommit to be off for batchSize to take effect.
public static void closeQuietly(ResultSet resultSet)
ResultSet, swallowing any SQLException.resultSet - public static void closeQuietly(Statement... statements)
Statement, swallowing any SQLException.statements - the list of statements to closepublic static void closeQuietly(Connection connection)
Connection, swallowing any SQLException.connection - public static void closeQuietly(ResultSet resultSet, Statement statement)
resultSet - statement - public static String quote(ImportExportErrorService errorService, String table, Connection connection, String identifier)
errorService - table - connection - the current connection being usedidentifier - the database identifier to quote @return the quoted database identifierImportExportException - if anything wrong happens getting information from the database connection.public static DatabaseMetaData metadata(ImportExportErrorService errorService, Connection connection)
public static Statement createStatement(ImportExportErrorService errorService, String table, Connection connection)
public static PreparedStatement preparedStatement(ImportExportErrorService errorService, String table, Connection connection, String sql)
Copyright © 2018 Atlassian. All rights reserved.