For any object you can use object.getClass().getName()
For JDBC connectivity, it looks like this:
String db_class = DriverManager.getConnection(db_url, usr, passwd).getClass().getName();
For my PostgreSQL driver, it returns:
org.postgresql.jdbc4.Jdbc4Connection
In your code, this should work:
ds.getConnection().getClass().getName()
And a simple procedure that shows the name of the connection class:
public static void show_connection_info(Connection conn) { System.out.println("Connection: " + conn); System.out.println("Connection class: " + conn.getClass()); System.out.println("Connection class name: " + conn.getClass().getName()); }
For the Oracle connection that I used in the test I received:
Connection: oracle.jdbc.driver.T4CConnection@1e1c66a Connection class: class oracle.jdbc.driver.T4CConnection Connection class name: oracle.jdbc.driver.T4CConnection
source share