Class JDBCUtils
java.lang.Object
org.exoplatform.services.database.utils.JDBCUtils
- Version:
- $Id: JDBCUtils.java 34360 2009-07-22 23:58:59Z tolusha $
- Author:
- Anatoliy Bazko
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcleanWhitespaces(String string) Replace whitespace characters with space character.static voidfreeResources(ResultSet resultSet, Statement statement, Connection conn) Closes database related resources.static StringgetAppropriateBlobType(DataSource dataSource) Returns appropriate blob type field for specific database.static StringgetAppropriateCharType(DataSource dataSource) Returns appropriate char type field for specific database.static StringgetAppropriateTimestamp(DataSource dataSource) Returns appropriate timestamp type field for specific database.static StringgetFullMessage(SQLException exception) Retrieves the full message from SQLException.static StringresolveDialect(DataSource dataSource) Returns dialect one of dialectDialectConstantsbased onDataSourcename.static String[]splitWithSQLDelimiter(String resource) Split string resource with SQL Delimiter.static booleantableExists(String tableName, Connection con) Indicates whether or not a given table exists
-
Field Details
-
SQL_DELIMITER
Default SQL delimiter.- See Also:
-
SQL_DELIMITER_COMMENT_PREFIX
SQL delimiter comment prefix.- See Also:
-
SQL_DELIMITER_COMMENT_SUFFIX
- See Also:
-
-
Method Details
-
tableExists
Indicates whether or not a given table exists- Parameters:
tableName- the name of the table to checkcon- the connection to use- Returns:
trueif it exists,falseotherwise
-
getFullMessage
Retrieves the full message from SQLException.- Parameters:
exception- SQLException which will be parsed
-
cleanWhitespaces
Replace whitespace characters with space character. -
splitWithSQLDelimiter
Split string resource with SQL Delimiter. Delimiter can be taken from resource at the begining of the first line. It surrounded withSQL_DELIMITER_COMMENT_PREFIXandSQL_DELIMITER_COMMENT_SUFFIX. Otherwise the default delimiter will be usedSQL_DELIMITER. -
getAppropriateBlobType
Returns appropriate blob type field for specific database.- Throws:
SQLException
-
getAppropriateTimestamp
Returns appropriate timestamp type field for specific database.- Throws:
SQLException
-
getAppropriateCharType
Returns appropriate char type field for specific database.- Throws:
SQLException
-
resolveDialect
Returns dialect one of dialectDialectConstantsbased onDataSourcename.- Throws:
SQLException
-
freeResources
Closes database related resources.
-