|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ccl.util.DBUtil
This class provides convenience methods to access a database via jdbc.
Nested Class Summary | |
static class |
DBUtil.DBConstant
This class is used to indicate the database currently used. |
Field Summary | |
static DBUtil.DBConstant |
INSTANTDB
Constant to indicate an InstantDB database. |
static DBUtil.DBConstant |
POSTGRESQL
Constant to indicate a PostgreSQL database. |
static DBUtil.DBConstant |
SYBASE
Constant to indicate a Sybase database. |
Constructor Summary | |
DBUtil()
|
Method Summary | |
static void |
close(java.sql.Statement statement_)
Closes the given statement and the connection it belongs to. |
static void |
copyRecord(java.sql.ResultSet rsRecord_,
java.util.Hashtable htRecord_)
Copies all columns from one record into a hashtable. |
static java.sql.Connection |
createConnection(DBUtil.DBConstant database,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String applicationname,
java.lang.String clienthost)
Creates a database connection. |
static java.sql.Connection |
createIDBConnection(java.lang.String sDatabaseFile)
Creates a instantdb database connection. |
static java.sql.Statement |
createIDBStatement(java.lang.String sDatabaseFile)
Creates a jsbc statement for the given instantdb database. |
static java.sql.Connection |
createPGConnection(java.lang.String sDatabaseName)
Creates a PostgreSQL database connection on the local host and the current user given the database name. |
static void |
deleteTable(java.sql.Connection connection_,
java.lang.String sTableName_)
Deletes the given table. |
static java.util.Vector |
getIDBUserTables(java.lang.String sDatabaseFile)
Gets the list of InstantDB user tables. |
static java.lang.String |
getNextId(java.sql.Statement statement,
java.lang.String sTableName)
Gets the next id for a given table. |
static java.util.Vector |
getUserTables(java.sql.Connection connection)
Gets the list of user tables. |
static void |
initializeDB(DBUtil.DBConstant database)
Initializes a database for either InstantDB, Sybase or whatsoever. |
static void |
initializeDB(java.lang.String sDriver)
Initializes a database with the given driver. |
static void |
initializeIDB()
Initializes an InstantDB database. |
static void |
initializePGDB()
Initializes a PostgreSQL database. |
static void |
initializeSybDB()
Initializes a Sybase database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final DBUtil.DBConstant INSTANTDB
public static final DBUtil.DBConstant SYBASE
public static final DBUtil.DBConstant POSTGRESQL
Constructor Detail |
public DBUtil()
Method Detail |
public static void initializeIDB() throws java.lang.Exception
java.lang.Exception
- if loading the driver class fails.public static void initializePGDB() throws java.lang.Exception
java.lang.Exception
- if loading the driver class fails.public static void initializeSybDB() throws java.lang.Exception
java.lang.Exception
- if loading the driver class fails.public static void initializeDB(java.lang.String sDriver) throws java.lang.Exception
java.lang.Exception
- if loading the driver class fails.public static void initializeDB(DBUtil.DBConstant database) throws java.lang.Exception
java.lang.Exception
- if loading the driver class fails.public static java.sql.Connection createIDBConnection(java.lang.String sDatabaseFile) throws java.sql.SQLException
java.sql.SQLException
- if creating connection fails.public static java.sql.Connection createPGConnection(java.lang.String sDatabaseName) throws java.sql.SQLException
java.sql.SQLException
- if creating connection fails.public static java.sql.Connection createConnection(DBUtil.DBConstant database, java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String applicationname, java.lang.String clienthost) throws java.sql.SQLException
java.sql.SQLException
- if creating connection fails.public static java.sql.Statement createIDBStatement(java.lang.String sDatabaseFile) throws java.sql.SQLException
java.sql.SQLException
- if creating connection fails.public static void close(java.sql.Statement statement_) throws java.sql.SQLException
java.sql.SQLException
- if anything goes wrong.public static void deleteTable(java.sql.Connection connection_, java.lang.String sTableName_) throws java.sql.SQLException
java.sql.SQLException
- if anything goes wrong.public static java.util.Vector getIDBUserTables(java.lang.String sDatabaseFile) throws java.lang.Exception
java.lang.Exception
- if anything goes wrong.public static java.util.Vector getUserTables(java.sql.Connection connection) throws java.lang.Exception
java.lang.Exception
- if anything goes wrong.public static void copyRecord(java.sql.ResultSet rsRecord_, java.util.Hashtable htRecord_) throws java.sql.SQLException
rsRecord_
- The result set pointing via next to the current record.htRecord_
- The hashtable used to copy over the record.
java.sql.SQLException
- if anything goes wrong.public static java.lang.String getNextId(java.sql.Statement statement, java.lang.String sTableName) throws java.sql.SQLException
java.sql.SQLException
- if anything goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |