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

Поиск
Список
Период
Сортировка
От K. Ari Krupnikov
Тема Re: Problem with connecting to postgres using jdbc7.0-1.2.jar
Дата
Msg-id 3C2A06DD.181F8A0D@cogsci.ed.ac.uk
обсуждение исходный текст
Ответ на Problem with connecting to postgres using jdbc7.0-1.2.jar  (Peter Adamek <peter.adamek@utoronto.ca>)
Список 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.

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Jens Carlberg
Дата:
Сообщение: Re: Problem with connecting to postgres using jdbc7.0-1.2.jar
Следующее
От: "K. Ari Krupnikov"
Дата:
Сообщение: org.postgresql.Connection#EscapeSQL and {d