|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ojb.broker.ant.DBUtility
public class DBUtility
DBUtility is a utility class for verifying that various Database objects exist in a specified database. This utility does not use the jdbc DatabaseMetaData object because not all jdbc drivers fully implement it (like org.hsqldb.jdbcDriver - suckers).
Constructor Summary | |
---|---|
DBUtility(String url,
String user,
String pwd)
DBUtility connects to the database in this constructor. |
Method Summary | |
---|---|
boolean |
exists(String tableName)
Checks the database for the existence of this table. |
void |
exists(String tableName,
String columnName,
boolean ignoreCase)
Checks the database for the existence of this table.column. |
void |
exists(String tableName,
String columnName,
String jdbcType,
boolean ignoreCase)
Checks the database for the existence of this table.column of the specified jdbc type. |
void |
existsUseWarnings(String tableName,
String columnName,
String jdbcType,
boolean ignoreCase)
Checks the database for the existence of this table.column of the specified jdbc type. |
protected void |
finalize()
|
int |
getJdbcType(String ojbType)
Determines the java.sql.Types constant value from an OJB FIELDDESCRIPTOR value. |
void |
release()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBUtility(String url, String user, String pwd) throws SQLException
url
- String representing the jdbc connection url. For example, "jdbc:hsqldb:target/test/OJB".user
- The database user account to use for logging on.pwd
- The password for the user
SQLException
- Throws SQLException if there are problems connecting to the database.
ClassNotFoundException
- Throws ClassNotFoundException if the jdbc driver class can not be found.Method Detail |
---|
public void release() throws SQLException
SQLException
public boolean exists(String tableName)
tableName
- String name of the table that you want check for existence.
public void exists(String tableName, String columnName, String jdbcType, boolean ignoreCase) throws SQLException
tableName
- String name of the table to check.columnName
- String name of the table column to check.jdbcType
- Case insensitive String representation of
the jdbc type of the column. Valid values
are string representations of the types listed
in java.sql.Types. For example, "bit", "float",
"varchar", "clob", etc.ignoreCase
- boolean flag that determines if the utility should
consider the column name case when searching for
the database table.column.
SQLException
- if the Table doesn't exist, if the column doesn't exist, if the column type doesn't match the specified jdbcType.public void existsUseWarnings(String tableName, String columnName, String jdbcType, boolean ignoreCase) throws SQLException, SQLWarning
tableName
- String name of the table to check.columnName
- String name of the table column to check.jdbcType
- Case insensitive String representation of
the jdbc type of the column. Valid values
are string representations of the types listed
in java.sql.Types. For example, "bit", "float",
"varchar", "clob", etc.ignoreCase
- boolean flag that determines if the utility should
consider the column name case when searching for
the database table.column.
SQLException
- if the Table doesn't exist, if the column doesn't exist.
SQLWarning
- if the column type doesn't match the specified jdbcType.public void exists(String tableName, String columnName, boolean ignoreCase) throws SQLException
tableName
- String name of the table to check.columnName
- String name of the table column to check.ignoreCase
- boolean flag that determines if the utility should
consider the column name case when searching for
the database table.column.
SQLException
- if the Table doesn't exist, if the column doesn't exist.public int getJdbcType(String ojbType) throws SQLException
type
- The FIELDDESCRIPTOR which JDBC type is to be determined.
SQLException
- if the type is not a valid jdbc type.
java.sql.Typesprotected void finalize()
finalize
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |