DriverManager.registerDriver - registers twice? - Mailing list pgsql-jdbc

From David Wall
Subject DriverManager.registerDriver - registers twice?
Date
Msg-id 53CDBAD8.8000005@computer.org
Whole thread Raw
Responses Re: DriverManager.registerDriver - registers twice?
List pgsql-jdbc
I have code like the following:

            Class<?> driverClass = Class.forName("org.postgresql.Driver");
            driver = (java.sql.Driver)driverClass.newInstance();
            DriverManager.registerDriver(driver);

When I check before this code to see what driver's are available via DriverManager.getDrivers(), it reports this (note there's only one non-PG driver for JDBC/ODBC):

18:03:14 BEFORE REGISTER DriverManager.getDrivers() returned driver: sun.jdbc.odbc.JdbcOdbcDriver@3315a56d name: sun.jdbc.odbc.JdbcOdbcDriver; accepts URL jdbc:postgresql://localhost.localdomain/demo: false

But right after, I show the driver instance I created, then do DriverManager.getDrivers() again, but this time I get TWO PG JDBC drivers (along with the JDBC/ODBC), the second of which matches the one I registered. 

18:03:14 DriverManager.registerDriver() org.postgresql.Driver@3086f9bf

18:03:14 AFTER REGISTER DriverManager.getDrivers() returned driver: sun.jdbc.odbc.JdbcOdbcDriver@3315a56d name: sun.jdbc.odbc.JdbcOdbcDriver; accepts URL jdbc:postgresql://localhost.localdomain/demo: false

18:03:14 AFTER REGISTER DriverManager.getDrivers() returned driver: org.postgresql.Driver@29559094 name: org.postgresql.Driver; accepts URL jdbc:postgresql://localhost.localdomain/demo: true
18:03:14 AFTER REGISTER DriverManager.getDrivers() returned driver: org.postgresql.Driver@3086f9bf name: org.postgresql.Driver; accepts URL jdbc:postgresql://localhost.localdomain/demo: true

Why are there two?  Where does the org.postgresql.Driver@29559094 instance come from?

I am running Java 1.7.0_25 with PG JDBC driver postgresql-9.2-1003.jdbc4.jar.

Thanks,
David

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Slow statement when using JDBC
Next
From: David Wall
Date:
Subject: Re: DriverManager.registerDriver - registers twice?