Connection con = DriverManager.getConnection ( |
url, "my-user", "my-passwd"); |
// If we were unable to connect, an exception |
// would have been thrown. So, if we get here, |
// we are successfully connected to the URL |
// Get the DatabaseMetaData object and display |
// some information about the connection |
DatabaseMetaData dma = con.getMetaData (); |
System.out.println("\nConnected to " + dma.getURL()); |
System.out.println("Driver " + |
dma.getDriverName()); |
System.out.println("Version " + |
dma.getDriverVersion()); |
System.out.println(""); |