Display Database Limitation for your connection in Java

Description

The following code shows how to display Database Limitation for your connection.

Example


 //from w ww .j a  v a2  s .c  om

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;

public class Main {
  public static void main(String[] args) throws Exception {
    Connection conn = getConnection();

    DatabaseMetaData mtdt = conn.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());

    conn.close();
  }

  private static Connection getConnection() throws Exception {
    Class.forName("org.hsqldb.jdbcDriver");
    String url = "jdbc:hsqldb:mem:data/tutorial";

    return DriverManager.getConnection(url, "sa", "");
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    JDBC »




Batch
Binary Data
Database
Date Time
Insert
ResultSet
SQL
Statement
Stored Function
Table