pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedWhy driver does not need to be registered?
2+ messages / 2 participants
[nested] [flat]
* Why driver does not need to be registered?
@ 2009-02-25 23:51 Jesus Maudes <jmaudes@ubu.es>
0 siblings, 1 reply; 2+ messages in thread
From: Jesus Maudes @ 2009-02-25 23:51 UTC (permalink / raw)
To: pgsql-jdbc
Hi
I'm using postgresql-8.3-604.jdbc3.jar driver
I have a very simple java program to inspect what drivers are initially
loaded:
import java.sql.DriverManager;
public class TestDrivers {
public static void main(String [] argv) {
java.util.Enumeration myDrivers = DriverManager.getDrivers();
while (misDrivers.hasMoreElements()){
System.out.println(misDrivers.nextElement());
}
}
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Why driver does not need to be registered?
@ 2009-02-25 23:58 Kris Jurka <books@ejurka.com>
parent: Jesus Maudes <jmaudes@ubu.es>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2009-02-25 23:58 UTC (permalink / raw)
To: Jesus Maudes <jmaudes@ubu.es>; +Cc: pgsql-jdbc
On Thu, 26 Feb 2009, Jesus Maudes wrote:
> [Why does the driver show up even though I didn't register it?]
>
The JDBC4 spec included with the 1.6 JVM includes autoloading
functionality by including a special file in the driver's jar file.
Section 9.2.1 of the JDBC4 spec says:
The DriverManager.getConnection method has been enhanced to support
the Java Standard Edition Service Provider mechanism. JDBC 4.0
Drivers must include the file META-INF/services/java.sql.Driver.
This file contains the name of the JDBC driver's implementation
of java.sql.Driver.
So the JVM will scan the jars available and look for this special file and
load the driver specified in it automatically.
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2009-02-25 23:58 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-02-25 23:51 Why driver does not need to be registered? Jesus Maudes <jmaudes@ubu.es>
2009-02-25 23:58 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox