List of usage examples for java.sql DatabaseMetaData storesLowerCaseQuotedIdentifiers
boolean storesLowerCaseQuotedIdentifiers() throws SQLException;
From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataLoggingHandler.java
/** * Handles given information./* w w w .j a va2s . co m*/ * @param metaData the database metadata. * @return <code>true</code> if the chain should be stopped. * @throws QueryJBuildException if the metadata cannot be logged. */ protected boolean handle(@NotNull final DatabaseMetaData metaData) throws QueryJBuildException { final boolean result = false; @Nullable Log t_Log = null; try { t_Log = UniqueLogFactory.getLog(DatabaseMetaDataLoggingHandler.class); if (t_Log != null) { t_Log.debug("Numeric functions:" + metaData.getNumericFunctions()); t_Log.debug("String functions:" + metaData.getStringFunctions()); t_Log.debug("System functions:" + metaData.getSystemFunctions()); t_Log.debug("Time functions:" + metaData.getTimeDateFunctions()); t_Log.debug("insertsAreDetected(TYPE_FORWARD_ONLY):" + metaData.insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("insertsAreDetected(TYPE_SCROLL_INSENSITIVE):" + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("insertsAreDetected(TYPE_SCROLL_SENS):" + metaData.insertsAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("isCatalogAtStart():" + metaData.isCatalogAtStart()); t_Log.debug("isReadOnly():" + metaData.isReadOnly()); /* * Fails for MySQL with a java.lang.AbstractMethodError * com.mysql.jdbc.jdbc2.DatabaseMetaData.locatorsUpdateCopy() t_Log.debug( "locatorsUpdateCopy():" + metaData.locatorsUpdateCopy()); */ t_Log.debug("nullPlusNonNullIsNull():" + metaData.nullPlusNonNullIsNull()); t_Log.debug("nullsAreSortedAtEnd():" + metaData.nullsAreSortedAtEnd()); t_Log.debug("nullsAreSortedAtStart():" + metaData.nullsAreSortedAtStart()); t_Log.debug("nullsAreSortedHigh():" + metaData.nullsAreSortedHigh()); t_Log.debug("nullsAreSortedLow():" + metaData.nullsAreSortedLow()); t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):" + metaData.othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):" + metaData.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):" + metaData.othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):" + metaData.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):" + metaData.othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):" + metaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY):" + metaData.ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENS):" + metaData.ownDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY):" + metaData.ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENS):" + metaData.ownInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY):" + metaData.ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENS):" + metaData.ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("storesLowerCaseIdentifiers():" + metaData.storesLowerCaseIdentifiers()); t_Log.debug("storesLowerCaseQuotedIdentifiers():" + metaData.storesLowerCaseQuotedIdentifiers()); t_Log.debug("storesMixedCaseIdentifiers():" + metaData.storesMixedCaseIdentifiers()); t_Log.debug("storesMixedCaseQuotedIdentifiers():" + metaData.storesMixedCaseQuotedIdentifiers()); t_Log.debug("storesUpperCaseIdentifiers():" + metaData.storesUpperCaseIdentifiers()); t_Log.debug("storesUpperCaseQuotedIdentifiers():" + metaData.storesUpperCaseQuotedIdentifiers()); t_Log.debug("supportsAlterTableWithAddColumn():" + metaData.supportsAlterTableWithAddColumn()); t_Log.debug("supportsAlterTableWithDropColumn():" + metaData.supportsAlterTableWithDropColumn()); t_Log.debug("supportsANSI92EntryLevelSQL():" + metaData.supportsANSI92EntryLevelSQL()); t_Log.debug("supportsANSI92FullSQL():" + metaData.supportsANSI92FullSQL()); t_Log.debug("supportsANSI92IntermediateSQL():" + metaData.supportsANSI92IntermediateSQL()); t_Log.debug("supportsBatchUpdates():" + metaData.supportsBatchUpdates()); t_Log.debug( "supportsCatalogsInDataManipulation():" + metaData.supportsCatalogsInDataManipulation()); t_Log.debug( "supportsCatalogsInIndexDefinitions():" + metaData.supportsCatalogsInIndexDefinitions()); t_Log.debug("supportsCatalogsInPrivilegeDefinitions():" + metaData.supportsCatalogsInPrivilegeDefinitions()); t_Log.debug("supportsCatalogsInProcedureCalls():" + metaData.supportsCatalogsInProcedureCalls()); t_Log.debug( "supportsCatalogsInTableDefinitions():" + metaData.supportsCatalogsInTableDefinitions()); t_Log.debug("supportsColumnAliasing():" + metaData.supportsColumnAliasing()); t_Log.debug("supportsConvert():" + metaData.supportsConvert()); t_Log.debug("supportsCoreSQLGrammar():" + metaData.supportsCoreSQLGrammar()); t_Log.debug("supportsCorrelatedSubqueries():" + metaData.supportsCorrelatedSubqueries()); t_Log.debug("supportsDataDefinitionAndDataManipulationTransactions():" + metaData.supportsDataDefinitionAndDataManipulationTransactions()); t_Log.debug("supportsDataManipulationTransactionsOnly():" + metaData.supportsDataManipulationTransactionsOnly()); t_Log.debug("supportsDifferentTableCorrelationNames():" + metaData.supportsDifferentTableCorrelationNames()); t_Log.debug("supportsExpressionsInOrderBy():" + metaData.supportsExpressionsInOrderBy()); t_Log.debug("supportsExtendedSQLGrammar():" + metaData.supportsExtendedSQLGrammar()); t_Log.debug("supportsFullOuterJoins():" + metaData.supportsFullOuterJoins()); String t_strSupportsGetGeneratedKeys = Boolean.FALSE.toString(); try { t_strSupportsGetGeneratedKeys = "" + metaData.supportsGetGeneratedKeys(); } catch (@NotNull final SQLException sqlException) { t_strSupportsGetGeneratedKeys += sqlException.getMessage(); } t_Log.debug("supportsGetGeneratedKeys():" + t_strSupportsGetGeneratedKeys); t_Log.debug("supportsGroupBy():" + metaData.supportsGroupBy()); t_Log.debug("supportsGroupByBeyondSelect():" + metaData.supportsGroupByBeyondSelect()); t_Log.debug("supportsGroupByUnrelated():" + metaData.supportsGroupByUnrelated()); t_Log.debug("supportsIntegrityEnhancementFacility():" + metaData.supportsIntegrityEnhancementFacility()); t_Log.debug("supportsLikeEscapeClause():" + metaData.supportsLikeEscapeClause()); t_Log.debug("supportsLimitedOuterJoins():" + metaData.supportsLimitedOuterJoins()); t_Log.debug("supportsMinimumSQLGrammar():" + metaData.supportsMinimumSQLGrammar()); t_Log.debug("supportsMixedCaseIdentifiers():" + metaData.supportsMixedCaseIdentifiers()); t_Log.debug( "supportsMixedCaseQuotedIdentifiers():" + metaData.supportsMixedCaseQuotedIdentifiers()); /* * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsMultipleOpenResults() t_Log.debug( "supportsMultipleOpenResults():" + metaData.supportsMultipleOpenResults()); */ t_Log.debug("supportsMultipleResultSets():" + metaData.supportsMultipleResultSets()); t_Log.debug("supportsMultipleTransactions():" + metaData.supportsMultipleTransactions()); /* * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsNamedParameters() t_Log.debug( "supportsNamedParameters():" + metaData.supportsNamedParameters()); */ t_Log.debug("supportsNonNullableColumns():" + metaData.supportsNonNullableColumns()); t_Log.debug("supportsOpenCursorsAcrossCommit():" + metaData.supportsOpenCursorsAcrossCommit()); t_Log.debug("supportsOpenCursorsAcrossRollback():" + metaData.supportsOpenCursorsAcrossRollback()); t_Log.debug( "supportsOpenStatementsAcrossCommit():" + metaData.supportsOpenStatementsAcrossCommit()); t_Log.debug("supportsOpenStatementsAcrossRollback():" + metaData.supportsOpenStatementsAcrossRollback()); t_Log.debug("supportsOrderByUnrelated():" + metaData.supportsOrderByUnrelated()); t_Log.debug("supportsOuterJoins():" + metaData.supportsOuterJoins()); t_Log.debug("supportsPositionedDelete():" + metaData.supportsPositionedDelete()); t_Log.debug("supportsPositionedUpdate():" + metaData.supportsPositionedUpdate()); t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_READ_ONLY):" + metaData .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)); t_Log.debug("supportsResultSetConcurrency(TYPE_FORWARD_ONLY,CONCUR_UPDATABLE):" + metaData .supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)); t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY):" + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)); t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE):" + metaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)); t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY):" + metaData .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY)); t_Log.debug("supportsResultSetConcurrency(TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE):" + metaData .supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)); /* * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsResultSetHoldability() t_Log.debug( "supportsResultSetHoldability(" + "HOLD_CURSORS_OVER_COMMIT):" + metaData.supportsResultSetHoldability( ResultSet.HOLD_CURSORS_OVER_COMMIT)); t_Log.debug( "supportsResultSetHoldability(" + "CLOSE_CURSORS_AT_COMMIT):" + metaData.supportsResultSetHoldability( ResultSet.CLOSE_CURSORS_AT_COMMIT)); */ t_Log.debug("supportsResultSetType(TYPE_FORWARD_ONLY):" + metaData.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE):" + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("supportsResultSetType(TYPE_SCROLL_SENSITIVE):" + metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)); /* * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsSavePoints() t_Log.debug( "supportsSavepoints():" + metaData.supportsSavepoints()); */ t_Log.debug("supportsSchemasInDataManipulation():" + metaData.supportsSchemasInDataManipulation()); t_Log.debug("supportsSchemasInIndexDefinitions():" + metaData.supportsSchemasInIndexDefinitions()); t_Log.debug("supportsSchemasInPrivilegeDefinitions():" + metaData.supportsSchemasInPrivilegeDefinitions()); t_Log.debug("supportsSchemasInProcedureCalls():" + metaData.supportsSchemasInProcedureCalls()); t_Log.debug("supportsSchemasInTableDefinitions():" + metaData.supportsSchemasInTableDefinitions()); t_Log.debug("supportsSelectForUpdate():" + metaData.supportsSelectForUpdate()); /* * Fails in MySQL 3.23.53 with a java.lang.AbstractMethodError * com.mysql.jdbc.jdbc2.DatabaseMetaData.supportsStatementPooling() t_Log.debug( "supportsStatementPooling():" + metaData.supportsStatementPooling()); */ t_Log.debug("supportsStoredProcedures():" + metaData.supportsStoredProcedures()); t_Log.debug("supportsSubqueriesInComparisons():" + metaData.supportsSubqueriesInComparisons()); t_Log.debug("supportsSubqueriesInExists():" + metaData.supportsSubqueriesInExists()); t_Log.debug("supportsSubqueriesInIns():" + metaData.supportsSubqueriesInIns()); t_Log.debug("supportsSubqueriesInQuantifieds():" + metaData.supportsSubqueriesInQuantifieds()); t_Log.debug("supportsTableCorrelationNames():" + metaData.supportsTableCorrelationNames()); t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_NONE):" + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE)); t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_COMMITTED):" + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED)); t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_READ_UNCOMMITTED):" + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED)); t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_REPEATABLE_READ):" + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ)); t_Log.debug("supportsTransactionIsolationLevel(TRANSACTION_SERIALIZABLE):" + metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE)); t_Log.debug("supportsTransactions():" + metaData.supportsTransactions()); t_Log.debug("supportsUnion():" + metaData.supportsUnion()); t_Log.debug("supportsUnionAll():" + metaData.supportsUnionAll()); t_Log.debug("updatesAreDetected(TYPE_FORWARD_ONLY):" + metaData.updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)); t_Log.debug("updatesAreDetected(TYPE_SCROLL_INSENSITIVE):" + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)); t_Log.debug("updatesAreDetected(" + "TYPE_SCROLL_SENS):" + metaData.updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)); t_Log.debug("usesLocalFilePerTable():" + metaData.usesLocalFilePerTable()); t_Log.debug("usesLocalFiles():" + metaData.usesLocalFiles()); } } catch (@NotNull final SQLException sqlException) { t_Log.error("Database metadata request failed.", sqlException); } return result; }
From source file:org.acmsl.queryj.tools.handlers.DatabaseMetaDataRetrievalHandler.java
/** * Analyzes the database metadata./*from ww w. j a va 2s .co m*/ * @param metaData such metadata. * @param parameters the command. */ protected void analyzeMetaData(@NotNull final DatabaseMetaData metaData, @NotNull final QueryJCommand parameters) { boolean t_bCaseSensitive = false; try { t_bCaseSensitive = metaData.storesLowerCaseIdentifiers() || metaData.storesLowerCaseQuotedIdentifiers() || metaData.storesMixedCaseIdentifiers() || metaData.storesMixedCaseQuotedIdentifiers() || metaData.storesUpperCaseIdentifiers() || metaData.storesUpperCaseQuotedIdentifiers(); } catch (@NotNull final SQLException cannotCheckCaseSensitivity) { @Nullable final Log t_Log = UniqueLogFactory.getLog(DatabaseMetaDataRetrievalHandler.class); if (t_Log != null) { t_Log.error("Cannot check whether the database engine is case sensitive or not.", cannotCheckCaseSensitivity); } } storeCaseSensitive(t_bCaseSensitive, parameters); }
From source file:org.apache.openjpa.jdbc.sql.DBDictionary.java
protected void setDelimitedCase(DatabaseMetaData metaData) { try {//w ww . jav a 2s . c o m if (metaData.storesMixedCaseQuotedIdentifiers()) { delimitedCase = SCHEMA_CASE_PRESERVE; } else if (metaData.storesUpperCaseQuotedIdentifiers()) { delimitedCase = SCHEMA_CASE_UPPER; } else if (metaData.storesLowerCaseQuotedIdentifiers()) { delimitedCase = SCHEMA_CASE_LOWER; } } catch (SQLException e) { getLog().warn("cannot-determine-identifier-case"); if (getLog().isTraceEnabled()) { getLog().trace(e.toString(), e); } } }
From source file:org.apache.openjpa.jdbc.sql.DBDictionary.java
/** * @param metadata the DatabaseMetaData to use to determine whether delimiters can be supported *//*w ww .ja v a2s . c o m*/ private void setSupportsDelimitedIdentifiers(DatabaseMetaData metaData) { try { supportsDelimitedIdentifiers = Boolean.valueOf(metaData.supportsMixedCaseQuotedIdentifiers() || metaData.storesLowerCaseQuotedIdentifiers() || metaData.storesUpperCaseQuotedIdentifiers()); } catch (SQLException e) { supportsDelimitedIdentifiers = Boolean.valueOf(false); getLog().warn(_loc.get("unknown-delim-support", e)); } }
From source file:org.apache.openjpa.jdbc.sql.DBDictionaryFactory.java
/** * Return a string containing all the property values of the given * database metadata./*from w w w . j a va 2 s . c o m*/ */ public static String toString(DatabaseMetaData meta) throws SQLException { String lineSep = J2DoPrivHelper.getLineSeparator(); StringBuilder buf = new StringBuilder(4096); try { buf.append("catalogSeparator: ").append(meta.getCatalogSeparator()).append(lineSep) .append("catalogTerm: ").append(meta.getCatalogTerm()).append(lineSep) .append("databaseProductName: ").append(meta.getDatabaseProductName()).append(lineSep) .append("databaseProductVersion: ").append(meta.getDatabaseProductVersion()).append(lineSep) .append("driverName: ").append(meta.getDriverName()).append(lineSep).append("driverVersion: ") .append(meta.getDriverVersion()).append(lineSep).append("extraNameCharacters: ") .append(meta.getExtraNameCharacters()).append(lineSep).append("identifierQuoteString: ") .append(meta.getIdentifierQuoteString()).append(lineSep).append("numericFunctions: ") .append(meta.getNumericFunctions()).append(lineSep).append("procedureTerm: ") .append(meta.getProcedureTerm()).append(lineSep).append("schemaTerm: ") .append(meta.getSchemaTerm()).append(lineSep).append("searchStringEscape: ") .append(meta.getSearchStringEscape()).append(lineSep).append("sqlKeywords: ") .append(meta.getSQLKeywords()).append(lineSep).append("stringFunctions: ") .append(meta.getStringFunctions()).append(lineSep).append("systemFunctions: ") .append(meta.getSystemFunctions()).append(lineSep).append("timeDateFunctions: ") .append(meta.getTimeDateFunctions()).append(lineSep).append("url: ").append(meta.getURL()) .append(lineSep).append("userName: ").append(meta.getUserName()).append(lineSep) .append("defaultTransactionIsolation: ").append(meta.getDefaultTransactionIsolation()) .append(lineSep).append("driverMajorVersion: ").append(meta.getDriverMajorVersion()) .append(lineSep).append("driverMinorVersion: ").append(meta.getDriverMinorVersion()) .append(lineSep).append("maxBinaryLiteralLength: ").append(meta.getMaxBinaryLiteralLength()) .append(lineSep).append("maxCatalogNameLength: ").append(meta.getMaxCatalogNameLength()) .append(lineSep).append("maxCharLiteralLength: ").append(meta.getMaxCharLiteralLength()) .append(lineSep).append("maxColumnNameLength: ").append(meta.getMaxColumnNameLength()) .append(lineSep).append("maxColumnsInGroupBy: ").append(meta.getMaxColumnsInGroupBy()) .append(lineSep).append("maxColumnsInIndex: ").append(meta.getMaxColumnsInIndex()) .append(lineSep).append("maxColumnsInOrderBy: ").append(meta.getMaxColumnsInOrderBy()) .append(lineSep).append("maxColumnsInSelect: ").append(meta.getMaxColumnsInSelect()) .append(lineSep).append("maxColumnsInTable: ").append(meta.getMaxColumnsInTable()) .append(lineSep).append("maxConnections: ").append(meta.getMaxConnections()).append(lineSep) .append("maxCursorNameLength: ").append(meta.getMaxCursorNameLength()).append(lineSep) .append("maxIndexLength: ").append(meta.getMaxIndexLength()).append(lineSep) .append("maxProcedureNameLength: ").append(meta.getMaxProcedureNameLength()).append(lineSep) .append("maxRowSize: ").append(meta.getMaxRowSize()).append(lineSep) .append("maxSchemaNameLength: ").append(meta.getMaxSchemaNameLength()).append(lineSep) .append("maxStatementLength: ").append(meta.getMaxStatementLength()).append(lineSep) .append("maxStatements: ").append(meta.getMaxStatements()).append(lineSep) .append("maxTableNameLength: ").append(meta.getMaxTableNameLength()).append(lineSep) .append("maxTablesInSelect: ").append(meta.getMaxTablesInSelect()).append(lineSep) .append("maxUserNameLength: ").append(meta.getMaxUserNameLength()).append(lineSep) .append("isCatalogAtStart: ").append(meta.isCatalogAtStart()).append(lineSep) .append("isReadOnly: ").append(meta.isReadOnly()).append(lineSep) .append("nullPlusNonNullIsNull: ").append(meta.nullPlusNonNullIsNull()).append(lineSep) .append("nullsAreSortedAtEnd: ").append(meta.nullsAreSortedAtEnd()).append(lineSep) .append("nullsAreSortedAtStart: ").append(meta.nullsAreSortedAtStart()).append(lineSep) .append("nullsAreSortedHigh: ").append(meta.nullsAreSortedHigh()).append(lineSep) .append("nullsAreSortedLow: ").append(meta.nullsAreSortedLow()).append(lineSep) .append("storesLowerCaseIdentifiers: ").append(meta.storesLowerCaseIdentifiers()) .append(lineSep).append("storesLowerCaseQuotedIdentifiers: ") .append(meta.storesLowerCaseQuotedIdentifiers()).append(lineSep) .append("storesMixedCaseIdentifiers: ").append(meta.storesMixedCaseIdentifiers()) .append(lineSep).append("storesMixedCaseQuotedIdentifiers: ") .append(meta.storesMixedCaseQuotedIdentifiers()).append(lineSep) .append("storesUpperCaseIdentifiers: ").append(meta.storesUpperCaseIdentifiers()) .append(lineSep).append("storesUpperCaseQuotedIdentifiers: ") .append(meta.storesUpperCaseQuotedIdentifiers()).append(lineSep) .append("supportsAlterTableWithAddColumn: ").append(meta.supportsAlterTableWithAddColumn()) .append(lineSep).append("supportsAlterTableWithDropColumn: ") .append(meta.supportsAlterTableWithDropColumn()).append(lineSep) .append("supportsANSI92EntryLevelSQL: ").append(meta.supportsANSI92EntryLevelSQL()) .append(lineSep).append("supportsANSI92FullSQL: ").append(meta.supportsANSI92FullSQL()) .append(lineSep).append("supportsANSI92IntermediateSQL: ") .append(meta.supportsANSI92IntermediateSQL()).append(lineSep) .append("supportsCatalogsInDataManipulation: ") .append(meta.supportsCatalogsInDataManipulation()).append(lineSep) .append("supportsCatalogsInIndexDefinitions: ") .append(meta.supportsCatalogsInIndexDefinitions()).append(lineSep) .append("supportsCatalogsInPrivilegeDefinitions: ") .append(meta.supportsCatalogsInPrivilegeDefinitions()).append(lineSep) .append("supportsCatalogsInProcedureCalls: ").append(meta.supportsCatalogsInProcedureCalls()) .append(lineSep).append("supportsCatalogsInTableDefinitions: ") .append(meta.supportsCatalogsInTableDefinitions()).append(lineSep) .append("supportsColumnAliasing: ").append(meta.supportsColumnAliasing()).append(lineSep) .append("supportsConvert: ").append(meta.supportsConvert()).append(lineSep) .append("supportsCoreSQLGrammar: ").append(meta.supportsCoreSQLGrammar()).append(lineSep) .append("supportsCorrelatedSubqueries: ").append(meta.supportsCorrelatedSubqueries()) .append(lineSep).append("supportsDataDefinitionAndDataManipulationTransactions: ") .append(meta.supportsDataDefinitionAndDataManipulationTransactions()).append(lineSep) .append("supportsDataManipulationTransactionsOnly: ") .append(meta.supportsDataManipulationTransactionsOnly()).append(lineSep) .append("supportsDifferentTableCorrelationNames: ") .append(meta.supportsDifferentTableCorrelationNames()).append(lineSep) .append("supportsExpressionsInOrderBy: ").append(meta.supportsExpressionsInOrderBy()) .append(lineSep).append("supportsExtendedSQLGrammar: ") .append(meta.supportsExtendedSQLGrammar()).append(lineSep).append("supportsFullOuterJoins: ") .append(meta.supportsFullOuterJoins()).append(lineSep).append("supportsGroupBy: ") .append(meta.supportsGroupBy()).append(lineSep).append("supportsGroupByBeyondSelect: ") .append(meta.supportsGroupByBeyondSelect()).append(lineSep).append("supportsGroupByUnrelated: ") .append(meta.supportsGroupByUnrelated()).append(lineSep) .append("supportsIntegrityEnhancementFacility: ") .append(meta.supportsIntegrityEnhancementFacility()).append(lineSep) .append("supportsLikeEscapeClause: ").append(meta.supportsLikeEscapeClause()).append(lineSep) .append("supportsLimitedOuterJoins: ").append(meta.supportsLimitedOuterJoins()).append(lineSep) .append("supportsMinimumSQLGrammar: ").append(meta.supportsMinimumSQLGrammar()).append(lineSep) .append("supportsMixedCaseIdentifiers: ").append(meta.supportsMixedCaseIdentifiers()) .append(lineSep).append("supportsMixedCaseQuotedIdentifiers: ") .append(meta.supportsMixedCaseQuotedIdentifiers()).append(lineSep) .append("supportsMultipleResultSets: ").append(meta.supportsMultipleResultSets()) .append(lineSep).append("supportsMultipleTransactions: ") .append(meta.supportsMultipleTransactions()).append(lineSep) .append("supportsNonNullableColumns: ").append(meta.supportsNonNullableColumns()) .append(lineSep).append("supportsOpenCursorsAcrossCommit: ") .append(meta.supportsOpenCursorsAcrossCommit()).append(lineSep) .append("supportsOpenCursorsAcrossRollback: ").append(meta.supportsOpenCursorsAcrossRollback()) .append(lineSep).append("supportsOpenStatementsAcrossCommit: ") .append(meta.supportsOpenStatementsAcrossCommit()).append(lineSep) .append("supportsOpenStatementsAcrossRollback: ") .append(meta.supportsOpenStatementsAcrossRollback()).append(lineSep) .append("supportsOrderByUnrelated: ").append(meta.supportsOrderByUnrelated()).append(lineSep) .append("supportsOuterJoins: ").append(meta.supportsOuterJoins()).append(lineSep) .append("supportsPositionedDelete: ").append(meta.supportsPositionedDelete()).append(lineSep) .append("supportsPositionedUpdate: ").append(meta.supportsPositionedUpdate()).append(lineSep) .append("supportsSchemasInDataManipulation: ").append(meta.supportsSchemasInDataManipulation()) .append(lineSep).append("supportsSchemasInIndexDefinitions: ") .append(meta.supportsSchemasInIndexDefinitions()).append(lineSep) .append("supportsSchemasInPrivilegeDefinitions: ") .append(meta.supportsSchemasInPrivilegeDefinitions()).append(lineSep) .append("supportsSchemasInProcedureCalls: ").append(meta.supportsSchemasInProcedureCalls()) .append(lineSep).append("supportsSchemasInTableDefinitions: ") .append(meta.supportsSchemasInTableDefinitions()).append(lineSep) .append("supportsSelectForUpdate: ").append(meta.supportsSelectForUpdate()).append(lineSep) .append("supportsStoredProcedures: ").append(meta.supportsStoredProcedures()).append(lineSep) .append("supportsSubqueriesInComparisons: ").append(meta.supportsSubqueriesInComparisons()) .append(lineSep).append("supportsSubqueriesInExists: ") .append(meta.supportsSubqueriesInExists()).append(lineSep).append("supportsSubqueriesInIns: ") .append(meta.supportsSubqueriesInIns()).append(lineSep) .append("supportsSubqueriesInQuantifieds: ").append(meta.supportsSubqueriesInQuantifieds()) .append(lineSep).append("supportsTableCorrelationNames: ") .append(meta.supportsTableCorrelationNames()).append(lineSep).append("supportsTransactions: ") .append(meta.supportsTransactions()).append(lineSep).append("supportsUnion: ") .append(meta.supportsUnion()).append(lineSep).append("supportsUnionAll: ") .append(meta.supportsUnionAll()).append(lineSep).append("usesLocalFilePerTable: ") .append(meta.usesLocalFilePerTable()).append(lineSep).append("usesLocalFiles: ") .append(meta.usesLocalFiles()).append(lineSep).append("allProceduresAreCallable: ") .append(meta.allProceduresAreCallable()).append(lineSep).append("allTablesAreSelectable: ") .append(meta.allTablesAreSelectable()).append(lineSep) .append("dataDefinitionCausesTransactionCommit: ") .append(meta.dataDefinitionCausesTransactionCommit()).append(lineSep) .append("dataDefinitionIgnoredInTransactions: ") .append(meta.dataDefinitionIgnoredInTransactions()).append(lineSep) .append("doesMaxRowSizeIncludeBlobs: ").append(meta.doesMaxRowSizeIncludeBlobs()) .append(lineSep).append("supportsBatchUpdates: ").append(meta.supportsBatchUpdates()); } catch (Throwable t) { // maybe abstract method error for jdbc 3 metadata method, or // other error buf.append(lineSep).append("Caught throwable: ").append(t); } return buf.toString(); }
From source file:org.culturegraph.mf.sql.util.JdbcUtil.java
public static ResultSet getTableMetadata(Connection jdbcConnection, String tableNamePattern, String schema, String catalog, boolean isQuoted) { ResultSet rs = null;// w ww . j av a 2 s . c om try { DatabaseMetaData meta = jdbcConnection.getMetaData(); if ((isQuoted && meta.storesMixedCaseQuotedIdentifiers())) { rs = meta.getTables(catalog, schema, tableNamePattern, TYPES); } else if ((isQuoted && meta.storesUpperCaseQuotedIdentifiers()) || (!isQuoted && meta.storesUpperCaseIdentifiers())) { rs = meta.getTables(StringHelper.toUpperCase(catalog), StringHelper.toUpperCase(schema), StringHelper.toUpperCase(tableNamePattern), TYPES); } else if ((isQuoted && meta.storesLowerCaseQuotedIdentifiers()) || (!isQuoted && meta.storesLowerCaseIdentifiers())) { rs = meta.getTables(StringHelper.toLowerCase(catalog), StringHelper.toLowerCase(schema), StringHelper.toLowerCase(tableNamePattern), TYPES); } else { rs = meta.getTables(catalog, schema, tableNamePattern, TYPES); } return rs; // while (rs.next()) { // String tableName = rs.getString("TABLE_NAME"); // System.out.println("table = " + tableName); // } } catch (SQLException sqlException) { sqlException.printStackTrace(); } finally { try { DbUtils.close(rs); } catch (SQLException e) { e.printStackTrace(); } } return null; }