|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrepast.simphony.freezedry.datasource.DBUtils
public class DBUtils
Utility methods for connecting to and working with databases.
| Constructor Summary | |
|---|---|
DBUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
doesTableExist(Connection con,
String tableName)
Checks if the table of the specified name exists. |
static List<String> |
getColumnNames(Connection con,
String tableName)
Retrieves the names of the columns of the specified table. |
static DataSource |
getDataSource(DBConnectionInfo info)
Gets a data source pointing to a database. |
static DataSource |
getDataSource(String userName,
String password,
String dbURL,
String driverName)
|
static boolean |
validateConnectionSettings(DBConnectionInfo info,
String infoMessage)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DBUtils()
| Method Detail |
|---|
public static DataSource getDataSource(DBConnectionInfo info)
throws ClassNotFoundException
PoolingDataSource
with a connection pool that will automatically grow when all of its members are in use and
another is requested.
connectionString - the connection string for the database (its URL)userName - the username (if necessary)password - the username (if necessary)driver - the driver to be used for connecting to the database
PoolingDataSource
ClassNotFoundException - when the driver can't be loaded
public static boolean doesTableExist(Connection con,
String tableName)
throws SQLException
con - the connection to the databasetableName - the name of the table
SQLException - when there is a problem querying the database
public static List<String> getColumnNames(Connection con,
String tableName)
throws SQLException
con - the connection to the databasetableName - the name of the database's table
SQLException
public static boolean validateConnectionSettings(DBConnectionInfo info,
String infoMessage)
public static DataSource getDataSource(String userName,
String password,
String dbURL,
String driverName)
throws ClassNotFoundException
ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||