|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.james.util.JDBCUtil
public abstract class JDBCUtil
Helper class for managing common JDBC tasks.
This class is abstract to allow implementations to take advantage of different logging capabilities/interfaces in different parts of the code.
Constructor Summary | |
---|---|
JDBCUtil()
|
Method Summary | |
---|---|
void |
closeJDBCConnection(java.sql.Connection conn)
Closes database connection and logs if an error is encountered |
void |
closeJDBCResultSet(java.sql.ResultSet aResultSet)
Closes database result set and logs if an error is encountered |
void |
closeJDBCStatement(java.sql.Statement stmt)
Closes database statement and logs if an error is encountered |
boolean |
columnExists(java.sql.DatabaseMetaData dbMetaData,
java.lang.String tableName,
java.lang.String columnName)
Checks database metadata to see if a column exists in a table Try UPPER, lower, and MixedCase, both on the table name and the column name, to see if the column is there. |
boolean |
columnExistsCaseSensitive(java.sql.DatabaseMetaData dbMetaData,
java.lang.String tableName,
java.lang.String columnName)
Checks database metadata to see if a column exists in a table. |
protected abstract void |
delegatedLog(java.lang.String errorString)
An abstract method which child classes override to handle logging of errors in their particular environments. |
boolean |
tableExists(java.sql.DatabaseMetaData dbMetaData,
java.lang.String tableName)
Checks database metadata to see if a table exists. |
boolean |
tableExistsCaseSensitive(java.sql.DatabaseMetaData dbMetaData,
java.lang.String tableName)
Checks database metadata to see if a table exists. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCUtil()
Method Detail |
---|
protected abstract void delegatedLog(java.lang.String errorString)
errorString
- the error message generatedpublic boolean tableExists(java.sql.DatabaseMetaData dbMetaData, java.lang.String tableName) throws java.sql.SQLException
dbMetaData
- the database metadata to be used to look up this tabletableName
- the table name
java.sql.SQLException
- if an exception is encountered while accessing the databasepublic boolean tableExistsCaseSensitive(java.sql.DatabaseMetaData dbMetaData, java.lang.String tableName) throws java.sql.SQLException
dbMetaData
- the database metadata to be used to look up this tabletableName
- the case sensitive table name
java.sql.SQLException
- if an exception is encountered while accessing the databasepublic boolean columnExists(java.sql.DatabaseMetaData dbMetaData, java.lang.String tableName, java.lang.String columnName) throws java.sql.SQLException
dbMetaData
- the database metadata to be used to look up this columntableName
- the table namecolumnName
- the column name
java.sql.SQLException
- if an exception is encountered while accessing the databasepublic boolean columnExistsCaseSensitive(java.sql.DatabaseMetaData dbMetaData, java.lang.String tableName, java.lang.String columnName) throws java.sql.SQLException
dbMetaData
- the database metadata to be used to look up this columntableName
- the case sensitive table namecolumnName
- the case sensitive column name
java.sql.SQLException
- if an exception is encountered while accessing the databasepublic void closeJDBCConnection(java.sql.Connection conn)
conn
- the connection to be closedpublic void closeJDBCStatement(java.sql.Statement stmt)
stmt
- the statement to be closedpublic void closeJDBCResultSet(java.sql.ResultSet aResultSet)
aResultSet
- the result set to be closed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |