Re: java.sql.SQLException: No suitable driver

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: java.sql.SQLException: No suitable driver
Дата
Msg-id 4451ED79.6020000@opencloud.com
обсуждение исходный текст
Ответ на Re: java.sql.SQLException: No suitable driver  ("Mads N. Vestergaard" <mnv@timmy.dk>)
Ответы Re: java.sql.SQLException: No suitable driver  ("Mads N. Vestergaard" <mnv@timmy.dk>)
Список pgsql-jdbc
Mads N. Vestergaard wrote:
> Hi Aliver,
>
> there isn't any conditional files in the environment variable CLASSPATH,
> and the program runs fine, it just can't connect to the database.

I am talking about both the CLASSPATH environment variable and the -cp
command line argument. In my experience, if you specify -jar, both are
ignored and classes are only loaded from the standard locations, and the
single jarfile parameter given to -jar ("program.jar" in your case).

Have you tried the command line I suggested?

>> java -cp /usr/share/java/pg74.216.jdbc3.jar:program.jar ProgramMainClass

Please try this and let us know if it works.

I would also suggest that silently ignoring ClassNotFoundException, as
the code you originally posted does, is a Really Bad Idea. That code is
masking the real source of the error: namely, that the driver classes
are *not* in your classpath.

-O

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

Предыдущее
От: "Mads N. Vestergaard"
Дата:
Сообщение: Re: java.sql.SQLException: No suitable driver
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Bug with callable statement and output parameters