List the SQL keywords support by the database in Java

Description

The following code shows how to list the SQL keywords support by the database.

Example


import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
//from  w  w  w  .  j a  va2s . c  o m
public class Main {
  public static void main(String[] args) throws Exception {
    Connection conn = getConnection();

    DatabaseMetaData mtdt = conn.getMetaData();
    System.out.println("supp. SQL Keywords: " + mtdt.getSQLKeywords());

    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