import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
public class Main {
public static Connection getConnection() throws Exception {
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@localhost:1521:databaseName";
String username = "name";
String password = "password";
Class.forName(driver); // load Oracle driver
Connection conn = DriverManager.getConnection(url, username, password);
return conn;
}
public static void main(String[] args) throws Exception {
Connection conn = getConnection();
try {
DatabaseMetaData dbmd = conn.getMetaData();
if (dbmd == null) {
System.out.println("No");
}
if (dbmd.supportsStatementPooling()) {
System.out.println("statement pooling is supported");
} else {
System.out.println("No");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
conn.close();
}
}
}
|