@UtilityMarker public final class DatabaseUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static Connection |
checkConnection(Connection connection) |
static ResultSet |
checkResultSet(ResultSet resultSet) |
static Statement |
createStatement(Connection connection) |
static ResultSet |
executeSql(Statement statement,
String sql) |
static long |
executeSqlForLong(Connection connection,
String sql) |
static Object |
executeSqlForScalar(Connection connection,
String sql) |
static Collection<Driver> |
getAvailableJdbcDrivers()
Load registered database drivers, and throw exception if any driver cannot be loaded.
|
static List<String> |
readResultsVector(ResultSet results)
Reads a single column result set as a list.
|
static List<String> |
readResultsVector(ResultSet results,
int columnNumber)
Reads a column in a result set as a list.
|
public static Connection checkConnection(Connection connection) throws SQLException
SQLExceptionpublic static ResultSet checkResultSet(ResultSet resultSet) throws SQLException
SQLExceptionpublic static Statement createStatement(Connection connection) throws SQLException
SQLExceptionpublic static Collection<Driver> getAvailableJdbcDrivers() throws SQLException
Do not use DriverManager.getDrivers(), since that swallows exceptions.
SQLExceptionpublic static ResultSet executeSql(Statement statement, String sql) throws SQLException
SQLExceptionpublic static long executeSqlForLong(Connection connection, String sql) throws SQLException
SQLExceptionpublic static Object executeSqlForScalar(Connection connection, String sql) throws SQLException
SQLExceptionpublic static List<String> readResultsVector(ResultSet results, int columnNumber) throws SQLException
results - Result setSQLException - On an exceptionpublic static List<String> readResultsVector(ResultSet results) throws SQLException
results - Result setSQLException - On an exceptionCopyright © 2000-2025 Sualeh Fatehi. Allrights reserved.