int i;
try {
FileProperties fp = new FileProperties("JDBCMeta.properties");
// Load the driver
Class.forName(fp.getProperty("driver"));
// Get the connection
Connection conn = DriverManager.getConnection (
fp.getProperty("dburl"),
fp.getProperty("user"),
fp.getProperty("password"));
// Get a Database MetaData as a way of interrogating
// the names of the tables in this database.
DatabaseMetaData meta = conn.getMetaData();
System.out.println("We are using " + meta.getDatabaseProductName());
System.out.println("Version is " + meta.getDatabaseProductVersion() );
int txisolation = meta.getDefaultTransactionIsolation();
System.out.println("Database default transaction isolation is " +
txisolation + " (" +
transactionIsolationToString(txisolation) + ").");
conn.close();
System.out.println("All done!");
} catch (java.io.IOException e) {
System.out.println("Can't load PROPERTIES " + e);
} catch (ClassNotFoundException e) {
System.out.println("Can't load driver " + e);
} catch (SQLException ex) {
System.out.println("Database access failed:");
System.out.println(ex);
}