Re: Problem with connecting to postgres using jdbc7.0-1.2.jar

From: "K(dot) Ari Krupnikov" <ari(at)cogsci(dot)ed(dot)ac(dot)uk>
To: Jens Carlberg <jenca(at)lysator(dot)liu(dot)se>
Cc: Peter Adamek <peter(dot)adamek(at)utoronto(dot)ca>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with connecting to postgres using jdbc7.0-1.2.jar
Date: 2001-12-26 17:20:29
Message-ID: 3C2A06DD.181F8A0D@cogsci.ed.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Jens Carlberg wrote:
>
> > Does anyone have any suggestions? It seems strage to me that if I
> > change the driver name that reads
> > Class.forName("org.postgresql.Driver"), I get no errors when I compile.

[...]

> If you wan't to handle it at compile time, look up the method
> DriverManager.registerDriver(Driver driver). The driver calls this
> itself when it is loaded, so it would be extra work without any good
> effects besides that you no longer need to catch CLasNotFound but a
> SQLException. :-)

You can simply say

new org.postgresql.Driver ();

The constructor (actually the static initialization) will call
registerDriver() for you.

Ari.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message K. Ari Krupnikov 2001-12-27 00:03:15 org.postgresql.Connection#EscapeSQL and {d
Previous Message Jens Carlberg 2001-12-26 16:40:53 Re: Problem with connecting to postgres using jdbc7.0-1.2.jar