Brought to you by EarthWeb
ITKnowledge Logo Login Graphic 60-day trial version of Microsoft Project 98
60-day trial version of Microsoft Project 98
ITKnowledge
Search this book:
 
Search the site:
 
EXPERT SEARCH ----- nav

EarthWeb Direct

EarthWeb Direct

EarthWeb sites: other sites

Previous Table of Contents Next


Features Supported

The DatabaseMetaData interface is a rich interface that provides many methods for discovering the features supported by the database.

DatabaseMetaData

boolean supportsAlterTableWithAddColumn();
boolean supportsAlterTableWithDropColumn();
boolean supportsColumnAliasing();
boolean nullPlusNonNullIsNull();
boolean supportsConvert();
boolean supportsConvert(int fromType, int toType);
boolean supportsTableCorrelationNames();
boolean supportsDifferentTableCorrelationNames();
boolean supportsExpressionsInOrderBy();
boolean supportsOrderByUnrelated();
boolean supportsGroupBy();
boolean supportsGroupByUnrelated();
boolean supportsGroupByBeyondSelect();
boolean supportsLikeEscapeClause();
boolean supportsMultipleResultSets();
boolean supportsMultipleTransactions();
boolean supportsNonNullableColumns();
boolean supportsMinimumSQLGrammar();
boolean supportsCoreSQLGrammar();
boolean supportsExtendedSQLGrammar();
boolean supportsANSI92EntryLevelSQL();
boolean supportsANSI92IntermediateSQL();
boolean supportsANSI92FullSQL();
boolean supportsIntegrityEnhancementFacility();
boolean supportsOuterJoins();
boolean supportsFullOuterJoins();
boolean supportsLimitedOuterJoins();
String getSchemaTerm();
String getProcedureTerm();
String getCatalogTerm();
boolean isCatalogAtStart();
String getCatalogSeparator();
boolean supportsSchemasInDataManipulation();
boolean supportsSchemasInProcedureCalls();
boolean supportsSchemasInTableDefinitions();
boolean supportsSchemasInIndexDefinitions();
boolean supportsSchemaInPriviledDefinitions();
boolean supportsCatalogsInDataManipulation();
boolean supportsCatalogsInProcedureCalls();
boolean supportsCatalogsInTableDefinitions();
boolean supportsCatalogsInIndexDefinitions();
boolean supportsCatalogsInPrivilegeDefinitions();
boolean supportsPositionedDelete();
boolean supportsPositionedUpdate();
boolean supportsSelectForUpdate();
boolean supportsStoredProcedures();
boolean supportsSubqueriesInComparisons();
boolean supportsSubqueriesInExists();
boolean supportsSubqueriesInIns();
boolean supportsSubqueriesInQuantifieds();
boolean supportsCorrelatedSubqueries();
boolean supportsUnion();
boolean supportsUnionAll();
boolean supportsOpenCursorAcrossCommit();
boolean supportsOpenCursorAcrossRollback();
boolean supportsOpenStatementAcrossCommit();
boolean supportsOpenStatementAcrossRollback();

Various Database Limitations

The DatabaseMetaData interface also provides many methods for discovering the database’s limitations.

DatabaseMetaData

int getMaxBinaryLiteralLength();
int getMaxCharLiteralLength();
int getMaxColumnNameLength();
int getMaxColumnsInGroupBy();
int getMaxColumnsInIndex();
int getMaxColumnsInOrderBy();
int getMaxColumnsInSelect();
int getMaxColumnsInTable();
int getMaxConnections();
int getMaxCursorNameLength();
int getMaxIndexLength();
int getMaxSchemaNameLength();
int getMaxProcedureNameLength();
int getMaxCatalogNameLength();
int getMaxRowSize();
boolean doesMaxRowSizeIncludeBlobs();
int getMaxStatementLength();
int getMaxStatements();
int getMaxTableNameLength();
int getMaxTablesInSelect();
int getMaxUserNameLength();
int getDefaultTransactionIsolation();
boolean supportsTransactions();
boolean supportsTransactionIsolationLevel(int level);
boolean supportsDataDefinitionAndDataManipulationTransactions();
boolean supportsDataManipulationTransactionsOnly();
boolean dataDefinitionCausesTransactionCommit();
boolean dataDefinitionIgnoredInTransactions();

Listing 7-5 illustrates a metadata method for discovering the database’s ANSI compliance level.

Listing 7-5: Metadata method for discovering ANSI compliance level.

// discovering ANSI compliance
import java.sql.*;
class SimpleExample
{
   public static void main(String args[])
   {
          String url = “jdbc:odbc:mysource”;
          try
   {
   Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
          Connection myConnection =
                  DriverManager.getConnection(url,
                          “javauser”, “hotjava”);
           DatabaseMetaData mtdt =
                  myConnection.getMetaData();
           System.out.println(“ANSI92 Entry Level: “ +
                  mtdt.supportsANSI92EntryLevelSQL());
           System.out.println(“ANSI92 Intermediate: “ +
                  mtdt.supportsANSI92IntermediateSQL());
           System.out.println(“ANSI92 Full SQL: “ +
                  mtdt.supportsANSI92FullSQL());
           System.out.println(“Minimum SQL Grammar: “ +
                  mtdt.supportsMinimumSQLGrammar());
           System.out.println(“Core SQL Grammar: “ +
                  mtdt.supportsCoreSQLGrammar());
    System.out.println(“Extended SQL Grammar: “
                  + mtdt.supportsExtendedSQLGrammar());
    myConnection.close();
    }
    catch(java.lang.Exception ex)
    {
            ex.printStackTrace ();
    }
 }
}

Information on Database Objects

The DatabaseMetaData interface also provides many methods for discovering the database’s contents.

DatabaseMetaData

ResultSet getProcedures(String catalog, String schemaPattern, String
 procedureNamePattern);
ResultSet getProcedureColumns(String catalog, String schemaPattern, String
 procedureNamePattern, String columnNamePattern);
ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern,
 String types[]);
getschemas();
ResultSet getCatalogs();
ResultSet getTableTypes();
ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String
 columnNamePattern);
ResultSet getColumnPrivileges(String catalog, String schema, String table, String
 columnNamePattern);
ResultSet getTablePrivileges(String catalog, String schemaPattern, String
 tableNamePattern);
ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope,
 boolean nullable);
ResultSet getVersionColumns(String catalog, String schema, String table);
ResultSet getPrimaryKeys(String catalog, String schema, String table);
ResultSet getImportedKeys(String catalog, String schema, String table);
ResultSet getExportedKeys(String catalog, String schema, String table);
ResultSet getCrossReference(String primaryCatalog, String
 primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable);
ResultSet getTypeInfo();
ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean
 approximate);


Previous Table of Contents Next
HomeAbout UsSearchSubscribeAdvertising InfoContact UsFAQs
Use of this site is subject to certain Terms & Conditions.
Copyright (c) 1996-1999 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.