Get system functions supported by database in Java
Description
The following code shows how to get system functions supported by database.
Example
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
/*from w w w . ja v a 2 s . c o m*/
public class Main {
public static void main(String[] args) throws Exception {
Connection connection = getConnection();
DatabaseMetaData metadata = connection.getMetaData();
String[] functions = metadata.getSystemFunctions().split(",\\s*");
for (int i = 0; i < functions.length; i++) {
String function = functions[i];
System.out.println("Function = " + function);
}
}
private static Connection getConnection() throws Exception {
Class.forName("org.hsqldb.jdbcDriver");
String url = "jdbc:hsqldb:mem:data/tutorial";
return DriverManager.getConnection(url, "sa", "");
}
}