Re: Right version of jdbc

Поиск
Список
Период
Сортировка
От postgresql439848@heinz-it.de
Тема Re: Right version of jdbc
Дата
Msg-id 571f47ce-4ee3-4fbb-a74d-499491497789@heinz-it.de
обсуждение исходный текст
Ответ на Re: Right version of jdbc  (Dave Cramer <davecramer@postgres.rocks>)
Список pgsql-general
Am 29.09.23 um 20:42 schrieb Dave Cramer:
> On Fri, 29 Sept 2023 at 14:22, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Thanks,
>>
>> there was really JDK 17 in use.
>> I changed it to Java 1.8
>> PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin> java
>> -version
>> java version "1.8.0_381"
>> Java(TM) SE Runtime Environment (build 1.8.0_381-b09)
>> Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)
>>
>> but the same error occured :
>> java.sql.SQLException: No suitable driver found for
>> jdbc:postgresql://localhost:5432/mushroom_database
>>          at java.sql.DriverManager.getConnection(DriverManager.java:689)
>>          at java.sql.DriverManager.getConnection(DriverManager.java:247)
>>          at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30)
>>   why  java.sql gives that error ?
>>
> for some reason the postgresql jar is not in the classpath.
>
> Dave
try to call "Class.forName("org.postgresql.Driver");" before "connection 
= DriverManager.getConnection(DB_URL, USER, PASSWORD);"
i had some issues with getConnection() some time ago and this was the 
solution. no idea why.



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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Right version of jdbc
Следующее
От: Craig McIlwee
Дата:
Сообщение: Re: Right version of jdbc