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("URL in use: " + mtdt.getURL());
System.out.println("User name: " + mtdt.getUserName());
System.out.println("DBMS name: " + mtdt.getDatabaseProductName());
System.out.println("DBMS version: " + mtdt.getDatabaseProductVersion());
System.out.println("Driver name: " + mtdt.getDriverName());
System.out.println("Driver version: " + mtdt.getDriverVersion());
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", "");
}
}
URL in use: jdbc:hsqldb:mem:data/tutorial
User name: SA
DBMS name: HSQL Database Engine
DBMS version: 1.8.0
Driver name: HSQL Database Engine Driver
Driver version: 1.8.0
supp. SQL Keywords: BEFORE,BIGINT,BINARY,CACHED,DATETIME,LIMIT,LONGVARBINARY,LONGVARCHAR,OBJECT,OTHER,SAVEPOINT,TEMP,TEXT,TOP,TRIGGER,TINYINT,VARBINARY,VARCHAR_IGNORECASE