pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedRight version of jdbc
43+ messages / 7 participants
[nested] [flat]
* Right version of jdbc
@ 2023-09-25 08:36 Raivo Rebane <raivore55@gmail.com>
0 siblings, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-25 08:36 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
I use :
PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
and
PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
What versions of jdbc driver I have to use for proper work ?
Regards,
Raivo
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 08:40 Thomas Kellerer <shammat@gmx.net>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 0 replies; 43+ messages in thread
From: Thomas Kellerer @ 2023-09-25 08:40 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Raivo Rebane schrieb am 25.09.2023 um 10:36:
> I use :
> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
> and
> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>
> What versions of jdbc driver I have to use for proper work ?
Use the latest, i.e. 42.6.0
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 11:27 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-25 11:27 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Hi,
The latest version of the driver is usually the right answer. So 42.5.4
Dave Cramer
www.postgres.rocks
On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> I use :
> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
> and
> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>
> What versions of jdbc driver I have to use for proper work ?
>
> Regards,
> Raivo
>
>
>
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 11:29 Dave Cramer <davecramer@postgres.rocks>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-25 11:29 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Sorry 42.6.0
Interesting that github still has 42.5.4 as the release
Dave Cramer
www.postgres.rocks
On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
wrote:
> Hi,
>
> The latest version of the driver is usually the right answer. So 42.5.4
> Dave Cramer
> www.postgres.rocks
>
>
> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>> I use :
>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>> and
>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>
>> What versions of jdbc driver I have to use for proper work ?
>>
>> Regards,
>> Raivo
>>
>>
>>
>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 12:26 Raivo Rebane <raivore55@gmail.com>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-25 12:26 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general@lists.postgresql.org
Hi,
now I using following -
[INFO] Copying postgis-jdbc-2.1.7.jar to
C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-2.1.7.jar
[INFO] Copying postgresql-42.6.0.jar to
C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.6.0.jar
[INFO] Copying checker-qual-3.31.0.jar to
C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\checker-qual-3.31.0.jar
but on executions I got -
Exception in thread "main" java.lang.NoClassDefFoundError:
org/postgis/PGgeometry
at
backendproject.ProcQueryMushrooms.ProcQuery(ProcQueryMushrooms.java:41)
at backendproject.BackendMain.main(BackendMain.java:81)
Caused by: java.lang.ClassNotFoundException: org.postgis.PGgeometry
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
What I have to do ?
I use following -
PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
Regards
Raivo
On Mon, Sep 25, 2023 at 2:29 PM Dave Cramer <davecramer@postgres.rocks>
wrote:
> Sorry 42.6.0
>
> Interesting that github still has 42.5.4 as the release
>
> Dave Cramer
> www.postgres.rocks
>
>
> On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>> Hi,
>>
>> The latest version of the driver is usually the right answer. So 42.5.4
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>> I use :
>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>> and
>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>>
>>> What versions of jdbc driver I have to use for proper work ?
>>>
>>> Regards,
>>> Raivo
>>>
>>>
>>>
>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 12:27 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 0 replies; 43+ messages in thread
From: Dave Cramer @ 2023-09-25 12:27 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
The missing class is from the postgis jar. Are you sure it is on your
classpath ?
Dave Cramer
www.postgres.rocks
On Mon, 25 Sept 2023 at 08:26, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> now I using following -
> [INFO] Copying postgis-jdbc-2.1.7.jar to
> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-2.1.7.jar
> [INFO] Copying postgresql-42.6.0.jar to
> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.6.0.jar
> [INFO] Copying checker-qual-3.31.0.jar to
> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\checker-qual-3.31.0.jar
> but on executions I got -
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/postgis/PGgeometry
> at
> backendproject.ProcQueryMushrooms.ProcQuery(ProcQueryMushrooms.java:41)
> at backendproject.BackendMain.main(BackendMain.java:81)
> Caused by: java.lang.ClassNotFoundException: org.postgis.PGgeometry
> at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
> at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>
> What I have to do ?
>
> I use following -
> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
> Regards
> Raivo
>
> On Mon, Sep 25, 2023 at 2:29 PM Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>> Sorry 42.6.0
>>
>> Interesting that github still has 42.5.4 as the release
>>
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
>> wrote:
>>
>>> Hi,
>>>
>>> The latest version of the driver is usually the right answer. So 42.5.4
>>> Dave Cramer
>>> www.postgres.rocks
>>>
>>>
>>> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com> wrote:
>>>
>>>> Hi,
>>>> I use :
>>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>>> and
>>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>>>
>>>> What versions of jdbc driver I have to use for proper work ?
>>>>
>>>> Regards,
>>>> Raivo
>>>>
>>>>
>>>>
>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 12:38 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-25 12:38 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general@lists.postgresql.org
Hi, now I use -
<dependencies>
<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.4</version> <!-- Kasuta kõige uuemat versiooni -->
</dependency>
</dependencies>
But I got error -
Exception in thread "main" java.lang.NoSuchMethodError:
'org.postgresql.core.Encoding
org.postgresql.core.BaseConnection.getEncoding()'
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1889)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:438)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2406)
at backendproject.BackendMain.main(BackendMain.java:64)
Whats wrong ?
Raivo
On Mon, Sep 25, 2023 at 3:26 PM Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> now I using following -
> [INFO] Copying postgis-jdbc-2.1.7.jar to
> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-2.1.7.jar
> [INFO] Copying postgresql-42.6.0.jar to
> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.6.0.jar
> [INFO] Copying checker-qual-3.31.0.jar to
> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\checker-qual-3.31.0.jar
> but on executions I got -
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/postgis/PGgeometry
> at
> backendproject.ProcQueryMushrooms.ProcQuery(ProcQueryMushrooms.java:41)
> at backendproject.BackendMain.main(BackendMain.java:81)
> Caused by: java.lang.ClassNotFoundException: org.postgis.PGgeometry
> at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
> at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>
> What I have to do ?
>
> I use following -
> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
> Regards
> Raivo
>
> On Mon, Sep 25, 2023 at 2:29 PM Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>> Sorry 42.6.0
>>
>> Interesting that github still has 42.5.4 as the release
>>
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
>> wrote:
>>
>>> Hi,
>>>
>>> The latest version of the driver is usually the right answer. So 42.5.4
>>> Dave Cramer
>>> www.postgres.rocks
>>>
>>>
>>> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com> wrote:
>>>
>>>> Hi,
>>>> I use :
>>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>>> and
>>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>>>
>>>> What versions of jdbc driver I have to use for proper work ?
>>>>
>>>> Regards,
>>>> Raivo
>>>>
>>>>
>>>>
>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 12:43 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-25 12:43 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general@lists.postgresql.org
And target/lib is s following :
Directory of C:\Users\Raivo\eclipse-workspace\backendproject\target\lib
25.09.2023 15:35 <DIR> .
25.09.2023 15:33 <DIR> ..
25.09.2023 15:33 214 381 checker-qual-3.5.0.jar
25.09.2023 13:14 75 847 postgis-jdbc-1.3.3.jar
25.09.2023 13:14 2 833 postgis-stubs-1.3.3.jar
25.09.2023 15:33 1 049 651 postgresql-42.5.4.jar
25.09.2023 13:14 474 746 postgresql-8.3-603.jdbc4.jar
Raivo
On Mon, Sep 25, 2023 at 3:38 PM Raivo Rebane <raivore55@gmail.com> wrote:
> Hi, now I use -
> <dependencies>
> <dependency>
> <groupId>org.postgis</groupId>
> <artifactId>postgis-jdbc</artifactId>
> <version>1.3.3</version>
> </dependency>
> <dependency>
> <groupId>org.postgresql</groupId>
> <artifactId>postgresql</artifactId>
> <version>42.5.4</version> <!-- Kasuta kõige uuemat versiooni -->
> </dependency>
> </dependencies>
> But I got error -
> Exception in thread "main" java.lang.NoSuchMethodError:
> 'org.postgresql.core.Encoding
> org.postgresql.core.BaseConnection.getEncoding()'
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1889)
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:438)
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2406)
> at backendproject.BackendMain.main(BackendMain.java:64)
>
> Whats wrong ?
>
> Raivo
>
> On Mon, Sep 25, 2023 at 3:26 PM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>> now I using following -
>> [INFO] Copying postgis-jdbc-2.1.7.jar to
>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-2.1.7.jar
>> [INFO] Copying postgresql-42.6.0.jar to
>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.6.0.jar
>> [INFO] Copying checker-qual-3.31.0.jar to
>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\checker-qual-3.31.0.jar
>> but on executions I got -
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/postgis/PGgeometry
>> at
>> backendproject.ProcQueryMushrooms.ProcQuery(ProcQueryMushrooms.java:41)
>> at backendproject.BackendMain.main(BackendMain.java:81)
>> Caused by: java.lang.ClassNotFoundException: org.postgis.PGgeometry
>> at
>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
>> at
>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
>> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>>
>> What I have to do ?
>>
>> I use following -
>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>> Regards
>> Raivo
>>
>> On Mon, Sep 25, 2023 at 2:29 PM Dave Cramer <davecramer@postgres.rocks>
>> wrote:
>>
>>> Sorry 42.6.0
>>>
>>> Interesting that github still has 42.5.4 as the release
>>>
>>> Dave Cramer
>>> www.postgres.rocks
>>>
>>>
>>> On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> The latest version of the driver is usually the right answer. So 42.5.4
>>>> Dave Cramer
>>>> www.postgres.rocks
>>>>
>>>>
>>>> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>> I use :
>>>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>>>> and
>>>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>>>>
>>>>> What versions of jdbc driver I have to use for proper work ?
>>>>>
>>>>> Regards,
>>>>> Raivo
>>>>>
>>>>>
>>>>>
>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 12:50 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 0 replies; 43+ messages in thread
From: Dave Cramer @ 2023-09-25 12:50 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
remove the postgresql-8.3-603.jdbc4.jar
Dave Cramer
www.postgres.rocks
On Mon, 25 Sept 2023 at 08:43, Raivo Rebane <raivore55@gmail.com> wrote:
> And target/lib is s following :
> Directory of C:\Users\Raivo\eclipse-workspace\backendproject\target\lib
>
> 25.09.2023 15:35 <DIR> .
> 25.09.2023 15:33 <DIR> ..
> 25.09.2023 15:33 214 381 checker-qual-3.5.0.jar
> 25.09.2023 13:14 75 847 postgis-jdbc-1.3.3.jar
> 25.09.2023 13:14 2 833 postgis-stubs-1.3.3.jar
> 25.09.2023 15:33 1 049 651 postgresql-42.5.4.jar
> 25.09.2023 13:14 474 746 postgresql-8.3-603.jdbc4.jar
>
> Raivo
>
>
> On Mon, Sep 25, 2023 at 3:38 PM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi, now I use -
>> <dependencies>
>> <dependency>
>> <groupId>org.postgis</groupId>
>> <artifactId>postgis-jdbc</artifactId>
>> <version>1.3.3</version>
>> </dependency>
>> <dependency>
>> <groupId>org.postgresql</groupId>
>> <artifactId>postgresql</artifactId>
>> <version>42.5.4</version> <!-- Kasuta kõige uuemat versiooni -->
>> </dependency>
>> </dependencies>
>> But I got error -
>> Exception in thread "main" java.lang.NoSuchMethodError:
>> 'org.postgresql.core.Encoding
>> org.postgresql.core.BaseConnection.getEncoding()'
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1889)
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:438)
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2406)
>> at backendproject.BackendMain.main(BackendMain.java:64)
>>
>> Whats wrong ?
>>
>> Raivo
>>
>> On Mon, Sep 25, 2023 at 3:26 PM Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>> now I using following -
>>> [INFO] Copying postgis-jdbc-2.1.7.jar to
>>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-2.1.7.jar
>>> [INFO] Copying postgresql-42.6.0.jar to
>>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.6.0.jar
>>> [INFO] Copying checker-qual-3.31.0.jar to
>>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\checker-qual-3.31.0.jar
>>> but on executions I got -
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/postgis/PGgeometry
>>> at
>>> backendproject.ProcQueryMushrooms.ProcQuery(ProcQueryMushrooms.java:41)
>>> at backendproject.BackendMain.main(BackendMain.java:81)
>>> Caused by: java.lang.ClassNotFoundException: org.postgis.PGgeometry
>>> at
>>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
>>> at
>>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
>>> at
>>> java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>>>
>>> What I have to do ?
>>>
>>> I use following -
>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>> Regards
>>> Raivo
>>>
>>> On Mon, Sep 25, 2023 at 2:29 PM Dave Cramer <davecramer@postgres.rocks>
>>> wrote:
>>>
>>>> Sorry 42.6.0
>>>>
>>>> Interesting that github still has 42.5.4 as the release
>>>>
>>>> Dave Cramer
>>>> www.postgres.rocks
>>>>
>>>>
>>>> On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The latest version of the driver is usually the right answer. So 42.5.4
>>>>> Dave Cramer
>>>>> www.postgres.rocks
>>>>>
>>>>>
>>>>> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I use :
>>>>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>>>>> and
>>>>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>>>>>
>>>>>> What versions of jdbc driver I have to use for proper work ?
>>>>>>
>>>>>> Regards,
>>>>>> Raivo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 13:30 Dave Cramer <davecramer@postgres.rocks>
0 siblings, 0 replies; 43+ messages in thread
From: Dave Cramer @ 2023-09-25 13:30 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; pgsql-general
It must be a dependency to something. postgis ?
Dave Cramer
www.postgres.rocks
On Mon, 25 Sept 2023 at 09:25, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> postgresql-8.3-603.jdbc4.jar is added by maven maven install. How to
> avoid it ?
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 16:03 Rob Sargent <robjsargent@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 0 replies; 43+ messages in thread
From: Rob Sargent @ 2023-09-25 16:03 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/25/23 06:38, Raivo Rebane wrote:
> Hi, now I use -
> <dependencies>
> <dependency>
> <groupId>org.postgis</groupId>
> <artifactId>postgis-jdbc</artifactId>
> <version>1.3.3</version>
> </dependency>
> <dependency>
> <groupId>org.postgresql</groupId>
> <artifactId>postgresql</artifactId>
> <version>42.5.4</version> <!-- Kasuta kõige uuemat versiooni -->
> </dependency>
> </dependencies>
> But I got error -
> Exception in thread "main" java.lang.NoSuchMethodError:
> 'org.postgresql.core.Encoding
> org.postgresql.core.BaseConnection.getEncoding()'
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1889)
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:438)
> at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2406)
> at backendproject.BackendMain.main(BackendMain.java:64)
>
> Whats wrong ?
Show your application CLASSPATH.
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-25 16:42 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 0 replies; 43+ messages in thread
From: Dave Cramer @ 2023-09-25 16:42 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
You should probably be using the latest version of postgis-jdbc
Maven Repository: net.postgis » postgis-jdbc » 2021.1.0 (mvnrepository.com)
<https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2021.1.0;
Dave Cramer
www.postgres.rocks
On Mon, 25 Sept 2023 at 08:43, Raivo Rebane <raivore55@gmail.com> wrote:
> And target/lib is s following :
> Directory of C:\Users\Raivo\eclipse-workspace\backendproject\target\lib
>
> 25.09.2023 15:35 <DIR> .
> 25.09.2023 15:33 <DIR> ..
> 25.09.2023 15:33 214 381 checker-qual-3.5.0.jar
> 25.09.2023 13:14 75 847 postgis-jdbc-1.3.3.jar
> 25.09.2023 13:14 2 833 postgis-stubs-1.3.3.jar
> 25.09.2023 15:33 1 049 651 postgresql-42.5.4.jar
> 25.09.2023 13:14 474 746 postgresql-8.3-603.jdbc4.jar
>
> Raivo
>
>
> On Mon, Sep 25, 2023 at 3:38 PM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi, now I use -
>> <dependencies>
>> <dependency>
>> <groupId>org.postgis</groupId>
>> <artifactId>postgis-jdbc</artifactId>
>> <version>1.3.3</version>
>> </dependency>
>> <dependency>
>> <groupId>org.postgresql</groupId>
>> <artifactId>postgresql</artifactId>
>> <version>42.5.4</version> <!-- Kasuta kõige uuemat versiooni -->
>> </dependency>
>> </dependencies>
>> But I got error -
>> Exception in thread "main" java.lang.NoSuchMethodError:
>> 'org.postgresql.core.Encoding
>> org.postgresql.core.BaseConnection.getEncoding()'
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1889)
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:438)
>> at
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2ResultSet.java:2406)
>> at backendproject.BackendMain.main(BackendMain.java:64)
>>
>> Whats wrong ?
>>
>> Raivo
>>
>> On Mon, Sep 25, 2023 at 3:26 PM Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>> now I using following -
>>> [INFO] Copying postgis-jdbc-2.1.7.jar to
>>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgis-jdbc-2.1.7.jar
>>> [INFO] Copying postgresql-42.6.0.jar to
>>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\postgresql-42.6.0.jar
>>> [INFO] Copying checker-qual-3.31.0.jar to
>>> C:\Users\Raivo\eclipse-workspace\backendproject\target\lib\checker-qual-3.31.0.jar
>>> but on executions I got -
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/postgis/PGgeometry
>>> at
>>> backendproject.ProcQueryMushrooms.ProcQuery(ProcQueryMushrooms.java:41)
>>> at backendproject.BackendMain.main(BackendMain.java:81)
>>> Caused by: java.lang.ClassNotFoundException: org.postgis.PGgeometry
>>> at
>>> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
>>> at
>>> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
>>> at
>>> java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
>>>
>>> What I have to do ?
>>>
>>> I use following -
>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>> Regards
>>> Raivo
>>>
>>> On Mon, Sep 25, 2023 at 2:29 PM Dave Cramer <davecramer@postgres.rocks>
>>> wrote:
>>>
>>>> Sorry 42.6.0
>>>>
>>>> Interesting that github still has 42.5.4 as the release
>>>>
>>>> Dave Cramer
>>>> www.postgres.rocks
>>>>
>>>>
>>>> On Mon, 25 Sept 2023 at 07:27, Dave Cramer <davecramer@postgres.rocks>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The latest version of the driver is usually the right answer. So 42.5.4
>>>>> Dave Cramer
>>>>> www.postgres.rocks
>>>>>
>>>>>
>>>>> On Mon, 25 Sept 2023 at 07:03, Raivo Rebane <raivore55@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I use :
>>>>>> PostgreSQL 15.2, compiled by Visual C++ build 1914, 64-bit
>>>>>> and
>>>>>> PostGIS 3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>>>>>>
>>>>>> What versions of jdbc driver I have to use for proper work ?
>>>>>>
>>>>>> Regards,
>>>>>> Raivo
>>>>>>
>>>>>>
>>>>>>
>>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-27 09:43 Dave Cramer <davecramer@postgres.rocks>
0 siblings, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-27 09:43 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; pgsql-general
First of all please use reply all so that everyone sees the answers.
Not sure since PgObject is certainly in the jdbc jar.
pgjdbc/pgjdbc/src/main/java/org/postgresql/util/PGobject.java
at 5709a20fbef453749d2394e11502527e4a3ab5bb · pgjdbc/pgjdbc (github.com)
<https://github.com/pgjdbc/pgjdbc/blob/5709a20fbef453749d2394e11502527e4a3ab5bb/pgjdbc/src/main/java/...;
I suggest at this point you provide a test project on github that you can
share.
There is something wrong with the classpath
Dave Cramer
www.postgres.rocks
On Wed, 27 Sept 2023 at 01:52, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> Thanks for response, but if I using following dependencies :
>
> <dependencies>
>
> <dependency>
>
> <groupId>net.postgis</groupId>
>
> <artifactId>postgis-jdbc</artifactId>
>
> <version>2021.1.0</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>org.postgresql</groupId>
>
> <artifactId>postgresql</artifactId>
>
> <version>42.6.0</version> <!-- Kasuta kõige uuemat versiooni -->
>
> </dependency>
>
> </dependencies>
>
> I have error :
>
> The type org.postgresql.util.PGobject cannot be resolved. It is indirectly
> referenced from required type org.postgis.PGgeometry
>
>
> What is wrong with me ?
>
>
> Raivo
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 06:18 Raivo Rebane <raivore55@gmail.com>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-28 06:18 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general
Hi,
I made a new Java application Eclipse Dynamic WEB application and want to
use Postgres - PostgreSQL 10.14 on x86_64-pc-linux-gnu, compiled by gcc
(Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit and Postgis - 2.4 USE_GEOS=1
USE_PROJ=1 USE_STATS=1.
I added some jdbc-s in my project webapps/WEB-INF/lib directory which now
contains - javax.servlet-api.jar postgis-jdbc-2.2.1.jar
postgresql-42.2.5.jre7.jar.
But they don't fit the needs and I got from tomcat -
java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost:5432/mushroom_database
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30)
What's wrong. Or is better to use more newer postgres. And then which
jdbc-I need to use ?
Regards
Raivo
On Wed, Sep 27, 2023 at 12:43 PM Dave Cramer <davecramer@postgres.rocks>
wrote:
> First of all please use reply all so that everyone sees the answers.
>
> Not sure since PgObject is certainly in the jdbc jar. pgjdbc/pgjdbc/src/main/java/org/postgresql/util/PGobject.java
> at 5709a20fbef453749d2394e11502527e4a3ab5bb · pgjdbc/pgjdbc (github.com)
> <https://github.com/pgjdbc/pgjdbc/blob/5709a20fbef453749d2394e11502527e4a3ab5bb/pgjdbc/src/main/java/...;
>
> I suggest at this point you provide a test project on github that you can
> share.
>
> There is something wrong with the classpath
>
> Dave Cramer
> www.postgres.rocks
>
>
> On Wed, 27 Sept 2023 at 01:52, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>> Thanks for response, but if I using following dependencies :
>>
>> <dependencies>
>>
>> <dependency>
>>
>> <groupId>net.postgis</groupId>
>>
>> <artifactId>postgis-jdbc</artifactId>
>>
>> <version>2021.1.0</version>
>>
>> </dependency>
>>
>> <dependency>
>>
>> <groupId>org.postgresql</groupId>
>>
>> <artifactId>postgresql</artifactId>
>>
>> <version>42.6.0</version> <!-- Kasuta kõige uuemat versiooni -->
>>
>> </dependency>
>>
>> </dependencies>
>>
>> I have error :
>>
>> The type org.postgresql.util.PGobject cannot be resolved. It is
>> indirectly referenced from required type org.postgis.PGgeometry
>>
>>
>> What is wrong with me ?
>>
>>
>> Raivo
>>
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 09:32 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-28 09:32 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general
Dave Cramer
www.postgres.rocks
On Thu, 28 Sept 2023 at 02:18, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
>
> I made a new Java application Eclipse Dynamic WEB application and want to
> use Postgres - PostgreSQL 10.14 on x86_64-pc-linux-gnu, compiled by gcc
> (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit and Postgis - 2.4 USE_GEOS=1
> USE_PROJ=1 USE_STATS=1.
>
> I added some jdbc-s in my project webapps/WEB-INF/lib directory which now
> contains - javax.servlet-api.jar postgis-jdbc-2.2.1.jar
> postgresql-42.2.5.jre7.jar.
>
postgresql-42.2.5.jre7.jar. is for java 7.
I suggest you use the latest versions of postgis and postgres jdbc
Dave
>
> But they don't fit the needs and I got from tomcat -
> java.sql.SQLException: No suitable driver found for
> jdbc:postgresql://localhost:5432/mushroom_database
> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
> at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30)
>
> What's wrong. Or is better to use more newer postgres. And then which
> jdbc-I need to use ?
>
> Regards
> Raivo
>
>
>
> On Wed, Sep 27, 2023 at 12:43 PM Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>> First of all please use reply all so that everyone sees the answers.
>>
>> Not sure since PgObject is certainly in the jdbc jar. pgjdbc/pgjdbc/src/main/java/org/postgresql/util/PGobject.java
>> at 5709a20fbef453749d2394e11502527e4a3ab5bb · pgjdbc/pgjdbc (github.com)
>> <https://github.com/pgjdbc/pgjdbc/blob/5709a20fbef453749d2394e11502527e4a3ab5bb/pgjdbc/src/main/java/...;
>>
>> I suggest at this point you provide a test project on github that you can
>> share.
>>
>> There is something wrong with the classpath
>>
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Wed, 27 Sept 2023 at 01:52, Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>> Thanks for response, but if I using following dependencies :
>>>
>>> <dependencies>
>>>
>>> <dependency>
>>>
>>> <groupId>net.postgis</groupId>
>>>
>>> <artifactId>postgis-jdbc</artifactId>
>>>
>>> <version>2021.1.0</version>
>>>
>>> </dependency>
>>>
>>> <dependency>
>>>
>>> <groupId>org.postgresql</groupId>
>>>
>>> <artifactId>postgresql</artifactId>
>>>
>>> <version>42.6.0</version> <!-- Kasuta kõige uuemat versiooni -->
>>>
>>> </dependency>
>>>
>>> </dependencies>
>>>
>>> I have error :
>>>
>>> The type org.postgresql.util.PGobject cannot be resolved. It is
>>> indirectly referenced from required type org.postgis.PGgeometry
>>>
>>>
>>> What is wrong with me ?
>>>
>>>
>>> Raivo
>>>
>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 15:41 Raivo Rebane <raivore55@gmail.com>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-28 15:41 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general
Now I changed the Postgres Server to version 15 and making Tomcat 9.0
project.
Now I am using postgresql-42.6.0.jar driver, but Tomcat gives error :
java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost:5432/mushroom_database
What driver I have to use for suitable driver.
Or must I downgrade my postgres version ?
Regards
Raivo
On Thu, Sep 28, 2023 at 12:32 PM Dave Cramer <davecramer@postgres.rocks>
wrote:
>
> Dave Cramer
> www.postgres.rocks
>
>
> On Thu, 28 Sept 2023 at 02:18, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>>
>> I made a new Java application Eclipse Dynamic WEB application and want to
>> use Postgres - PostgreSQL 10.14 on x86_64-pc-linux-gnu, compiled by gcc
>> (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit and Postgis - 2.4 USE_GEOS=1
>> USE_PROJ=1 USE_STATS=1.
>>
>> I added some jdbc-s in my project webapps/WEB-INF/lib directory which now
>> contains - javax.servlet-api.jar postgis-jdbc-2.2.1.jar
>> postgresql-42.2.5.jre7.jar.
>>
>
> postgresql-42.2.5.jre7.jar. is for java 7.
> I suggest you use the latest versions of postgis and postgres jdbc
>
> Dave
>
>>
>> But they don't fit the needs and I got from tomcat -
>> java.sql.SQLException: No suitable driver found for
>> jdbc:postgresql://localhost:5432/mushroom_database
>> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
>> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
>> at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30)
>>
>> What's wrong. Or is better to use more newer postgres. And then which
>> jdbc-I need to use ?
>>
>> Regards
>> Raivo
>>
>>
>>
>> On Wed, Sep 27, 2023 at 12:43 PM Dave Cramer <davecramer@postgres.rocks>
>> wrote:
>>
>>> First of all please use reply all so that everyone sees the answers.
>>>
>>> Not sure since PgObject is certainly in the jdbc jar. pgjdbc/pgjdbc/src/main/java/org/postgresql/util/PGobject.java
>>> at 5709a20fbef453749d2394e11502527e4a3ab5bb · pgjdbc/pgjdbc (github.com)
>>> <https://github.com/pgjdbc/pgjdbc/blob/5709a20fbef453749d2394e11502527e4a3ab5bb/pgjdbc/src/main/java/...;
>>>
>>> I suggest at this point you provide a test project on github that you
>>> can share.
>>>
>>> There is something wrong with the classpath
>>>
>>> Dave Cramer
>>> www.postgres.rocks
>>>
>>>
>>> On Wed, 27 Sept 2023 at 01:52, Raivo Rebane <raivore55@gmail.com> wrote:
>>>
>>>> Hi,
>>>> Thanks for response, but if I using following dependencies :
>>>>
>>>> <dependencies>
>>>>
>>>> <dependency>
>>>>
>>>> <groupId>net.postgis</groupId>
>>>>
>>>> <artifactId>postgis-jdbc</artifactId>
>>>>
>>>> <version>2021.1.0</version>
>>>>
>>>> </dependency>
>>>>
>>>> <dependency>
>>>>
>>>> <groupId>org.postgresql</groupId>
>>>>
>>>> <artifactId>postgresql</artifactId>
>>>>
>>>> <version>42.6.0</version> <!-- Kasuta kõige uuemat versiooni -->
>>>>
>>>> </dependency>
>>>>
>>>> </dependencies>
>>>>
>>>> I have error :
>>>>
>>>> The type org.postgresql.util.PGobject cannot be resolved. It is
>>>> indirectly referenced from required type org.postgis.PGgeometry
>>>>
>>>>
>>>> What is wrong with me ?
>>>>
>>>>
>>>> Raivo
>>>>
>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 15:48 Rob Sargent <robjsargent@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 0 replies; 43+ messages in thread
From: Rob Sargent @ 2023-09-28 15:48 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/28/23 09:41, Raivo Rebane wrote:
> Now I changed the Postgres Server to version 15 and making Tomcat 9.0
> project.
> Now I am using postgresql-42.6.0.jar driver, but Tomcat gives error :
> java.sql.SQLException: No suitable driver found for
> jdbc:postgresql://localhost:5432/mushroom_database
> What driver I have to use for suitable driver.
> Or must I downgrade my postgres version ?
>
Can you show the code you use to make the database connection?
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 15:53 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-28 15:53 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general
Or may be I am using wrong version of Java - java version "17.0.8"
2023-07-18 LTS
Raivo
On Thu, Sep 28, 2023 at 6:41 PM Raivo Rebane <raivore55@gmail.com> wrote:
> Now I changed the Postgres Server to version 15 and making Tomcat 9.0
> project.
> Now I am using postgresql-42.6.0.jar driver, but Tomcat gives error :
> java.sql.SQLException: No suitable driver found for
> jdbc:postgresql://localhost:5432/mushroom_database
> What driver I have to use for suitable driver.
> Or must I downgrade my postgres version ?
>
> Regards
> Raivo
>
> On Thu, Sep 28, 2023 at 12:32 PM Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>>
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Thu, 28 Sept 2023 at 02:18, Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I made a new Java application Eclipse Dynamic WEB application and want
>>> to use Postgres - PostgreSQL 10.14 on x86_64-pc-linux-gnu, compiled by gcc
>>> (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit and Postgis - 2.4 USE_GEOS=1
>>> USE_PROJ=1 USE_STATS=1.
>>>
>>> I added some jdbc-s in my project webapps/WEB-INF/lib directory which
>>> now contains - javax.servlet-api.jar postgis-jdbc-2.2.1.jar
>>> postgresql-42.2.5.jre7.jar.
>>>
>>
>> postgresql-42.2.5.jre7.jar. is for java 7.
>> I suggest you use the latest versions of postgis and postgres jdbc
>>
>> Dave
>>
>>>
>>> But they don't fit the needs and I got from tomcat -
>>> java.sql.SQLException: No suitable driver found for
>>> jdbc:postgresql://localhost:5432/mushroom_database
>>> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
>>> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
>>> at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30)
>>>
>>> What's wrong. Or is better to use more newer postgres. And then which
>>> jdbc-I need to use ?
>>>
>>> Regards
>>> Raivo
>>>
>>>
>>>
>>> On Wed, Sep 27, 2023 at 12:43 PM Dave Cramer <davecramer@postgres.rocks>
>>> wrote:
>>>
>>>> First of all please use reply all so that everyone sees the answers.
>>>>
>>>> Not sure since PgObject is certainly in the jdbc jar. pgjdbc/pgjdbc/src/main/java/org/postgresql/util/PGobject.java
>>>> at 5709a20fbef453749d2394e11502527e4a3ab5bb · pgjdbc/pgjdbc (github.com)
>>>> <https://github.com/pgjdbc/pgjdbc/blob/5709a20fbef453749d2394e11502527e4a3ab5bb/pgjdbc/src/main/java/...;
>>>>
>>>> I suggest at this point you provide a test project on github that you
>>>> can share.
>>>>
>>>> There is something wrong with the classpath
>>>>
>>>> Dave Cramer
>>>> www.postgres.rocks
>>>>
>>>>
>>>> On Wed, 27 Sept 2023 at 01:52, Raivo Rebane <raivore55@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>> Thanks for response, but if I using following dependencies :
>>>>>
>>>>> <dependencies>
>>>>>
>>>>> <dependency>
>>>>>
>>>>> <groupId>net.postgis</groupId>
>>>>>
>>>>> <artifactId>postgis-jdbc</artifactId>
>>>>>
>>>>> <version>2021.1.0</version>
>>>>>
>>>>> </dependency>
>>>>>
>>>>> <dependency>
>>>>>
>>>>> <groupId>org.postgresql</groupId>
>>>>>
>>>>> <artifactId>postgresql</artifactId>
>>>>>
>>>>> <version>42.6.0</version> <!-- Kasuta kõige uuemat versiooni -->
>>>>>
>>>>> </dependency>
>>>>>
>>>>> </dependencies>
>>>>>
>>>>> I have error :
>>>>>
>>>>> The type org.postgresql.util.PGobject cannot be resolved. It is
>>>>> indirectly referenced from required type org.postgis.PGgeometry
>>>>>
>>>>>
>>>>> What is wrong with me ?
>>>>>
>>>>>
>>>>> Raivo
>>>>>
>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 16:50 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 0 replies; 43+ messages in thread
From: Dave Cramer @ 2023-09-28 16:50 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general
Please put this project on github so we can see it.
Thanks
Dave Cramer
www.postgres.rocks
On Thu, 28 Sept 2023 at 11:53, Raivo Rebane <raivore55@gmail.com> wrote:
> Or may be I am using wrong version of Java - java version "17.0.8"
> 2023-07-18 LTS
>
> Raivo
>
> On Thu, Sep 28, 2023 at 6:41 PM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Now I changed the Postgres Server to version 15 and making Tomcat 9.0
>> project.
>> Now I am using postgresql-42.6.0.jar driver, but Tomcat gives error :
>> java.sql.SQLException: No suitable driver found for
>> jdbc:postgresql://localhost:5432/mushroom_database
>> What driver I have to use for suitable driver.
>> Or must I downgrade my postgres version ?
>>
>> Regards
>> Raivo
>>
>> On Thu, Sep 28, 2023 at 12:32 PM Dave Cramer <davecramer@postgres.rocks>
>> wrote:
>>
>>>
>>> Dave Cramer
>>> www.postgres.rocks
>>>
>>>
>>> On Thu, 28 Sept 2023 at 02:18, Raivo Rebane <raivore55@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I made a new Java application Eclipse Dynamic WEB application and want
>>>> to use Postgres - PostgreSQL 10.14 on x86_64-pc-linux-gnu, compiled by gcc
>>>> (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit and Postgis - 2.4 USE_GEOS=1
>>>> USE_PROJ=1 USE_STATS=1.
>>>>
>>>> I added some jdbc-s in my project webapps/WEB-INF/lib directory which
>>>> now contains - javax.servlet-api.jar postgis-jdbc-2.2.1.jar
>>>> postgresql-42.2.5.jre7.jar.
>>>>
>>>
>>> postgresql-42.2.5.jre7.jar. is for java 7.
>>> I suggest you use the latest versions of postgis and postgres jdbc
>>>
>>> Dave
>>>
>>>>
>>>> But they don't fit the needs and I got from tomcat -
>>>> java.sql.SQLException: No suitable driver found for
>>>> jdbc:postgresql://localhost:5432/mushroom_database
>>>> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
>>>> at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
>>>> at MushroomAPIs.AddMushrooms.doGet(AddMushrooms.java:30)
>>>>
>>>> What's wrong. Or is better to use more newer postgres. And then which
>>>> jdbc-I need to use ?
>>>>
>>>> Regards
>>>> Raivo
>>>>
>>>>
>>>>
>>>> On Wed, Sep 27, 2023 at 12:43 PM Dave Cramer <davecramer@postgres.rocks>
>>>> wrote:
>>>>
>>>>> First of all please use reply all so that everyone sees the answers.
>>>>>
>>>>> Not sure since PgObject is certainly in the jdbc jar. pgjdbc/pgjdbc/src/main/java/org/postgresql/util/PGobject.java
>>>>> at 5709a20fbef453749d2394e11502527e4a3ab5bb · pgjdbc/pgjdbc (github.com)
>>>>> <https://github.com/pgjdbc/pgjdbc/blob/5709a20fbef453749d2394e11502527e4a3ab5bb/pgjdbc/src/main/java/...;
>>>>>
>>>>> I suggest at this point you provide a test project on github that you
>>>>> can share.
>>>>>
>>>>> There is something wrong with the classpath
>>>>>
>>>>> Dave Cramer
>>>>> www.postgres.rocks
>>>>>
>>>>>
>>>>> On Wed, 27 Sept 2023 at 01:52, Raivo Rebane <raivore55@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>> Thanks for response, but if I using following dependencies :
>>>>>>
>>>>>> <dependencies>
>>>>>>
>>>>>> <dependency>
>>>>>>
>>>>>> <groupId>net.postgis</groupId>
>>>>>>
>>>>>> <artifactId>postgis-jdbc</artifactId>
>>>>>>
>>>>>> <version>2021.1.0</version>
>>>>>>
>>>>>> </dependency>
>>>>>>
>>>>>> <dependency>
>>>>>>
>>>>>> <groupId>org.postgresql</groupId>
>>>>>>
>>>>>> <artifactId>postgresql</artifactId>
>>>>>>
>>>>>> <version>42.6.0</version> <!-- Kasuta kõige uuemat versiooni -->
>>>>>>
>>>>>> </dependency>
>>>>>>
>>>>>> </dependencies>
>>>>>>
>>>>>> I have error :
>>>>>>
>>>>>> The type org.postgresql.util.PGobject cannot be resolved. It is
>>>>>> indirectly referenced from required type org.postgis.PGgeometry
>>>>>>
>>>>>>
>>>>>> What is wrong with me ?
>>>>>>
>>>>>>
>>>>>> Raivo
>>>>>>
>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Right version of jdbc
@ 2023-09-28 18:51 Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-28 18:51 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org; +Cc: Dave Cramer <davecramer@postgres.rocks>
Hi,
The same problem of postgres-jdbc compatibility remains and I pushed it to
github - https://github.com/raaivore/APIexperiment.
I am using Postgres 15 and Java 1.8 and Tomcat9.
Maybe somebody can help me to solve the problem.
Regards
Raivo
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 20:06 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-28 20:06 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
The latest version of postgis-jdbc is Maven Repository: net.postgis »
postgis-jdbc » 2021.1.0 (mvnrepository.com)
<https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2021.1.0;
Dave Cramer
www.postgres.rocks
On Thu, 28 Sept 2023 at 14:51, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
>
> The same problem of postgres-jdbc compatibility remains and I pushed it to
> github - https://github.com/raaivore/APIexperiment.
>
> I am using Postgres 15 and Java 1.8 and Tomcat9.
> Maybe somebody can help me to solve the problem.
>
> Regards
> Raivo
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-28 20:38 Ron <ronljohnsonjr@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 1 reply; 43+ messages in thread
From: Ron @ 2023-09-28 20:38 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/28/23 01:18, Raivo Rebane wrote:
[snip]
> I made a new Java application Eclipse Dynamic WEB application and want to
> use Postgres - PostgreSQL 10.14
[snip]
> What's wrong. Or is better to use more newer postgres. And then which
> jdbc-I need to use ?
https://www.postgresql.org/support/versioning/
Pg 10 will be EOL in *6 weeks*. Thus, "yes, use a newer version of
Postgresql" (unless, like me, you're constrained by circumstances like "the
business won't let us upgrade").
Pg 15 and the latest JDBC are in the repositories:
https://www.postgresql.org/download/
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 04:18 Raivo Rebane <raivore55@gmail.com>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-29 04:18 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general@lists.postgresql.org
If I use this jar i give errors - Description Resource Path Location Type
PGgeometry cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
PGgeometry cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
PGgeometry cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
Point cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 14 Java Problem
Point cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 35 Java Problem
Point cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
Point cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
Point cannot be resolved to a type ProcAddMushrooms.java
/KatseAPIs/src/main/java/MushroomAPIs line 83 Java Problem
Point cannot be resolved to a type Utils.java
/KatseAPIs/src/main/java/MushroomAPIs line 9 Java Problem
Point cannot be resolved to a type Utils.java
/KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
Raivo
On Thu, Sep 28, 2023 at 11:06 PM Dave Cramer <davecramer@postgres.rocks>
wrote:
> The latest version of postgis-jdbc is Maven Repository: net.postgis »
> postgis-jdbc » 2021.1.0 (mvnrepository.com)
> <https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2021.1.0;
> Dave Cramer
> www.postgres.rocks
>
>
> On Thu, 28 Sept 2023 at 14:51, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>>
>> The same problem of postgres-jdbc compatibility remains and I pushed it
>> to github - https://github.com/raaivore/APIexperiment.
>>
>> I am using Postgres 15 and Java 1.8 and Tomcat9.
>> Maybe somebody can help me to solve the problem.
>>
>> Regards
>> Raivo
>>
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 05:14 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-29 05:14 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general@lists.postgresql.org
It goes better, if I add postgis-geometry-2.5.0.jar and Eclipse founds
import org.postgis.Point;
Raivo
On Fri, Sep 29, 2023 at 7:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
> If I use this jar i give errors - Description Resource Path Location Type
> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
> Point cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 14 Java Problem
> Point cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 35 Java Problem
> Point cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
> Point cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
> Point cannot be resolved to a type ProcAddMushrooms.java
> /KatseAPIs/src/main/java/MushroomAPIs line 83 Java Problem
> Point cannot be resolved to a type Utils.java
> /KatseAPIs/src/main/java/MushroomAPIs line 9 Java Problem
> Point cannot be resolved to a type Utils.java
> /KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
>
> Raivo
>
> On Thu, Sep 28, 2023 at 11:06 PM Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>> The latest version of postgis-jdbc is Maven Repository: net.postgis »
>> postgis-jdbc » 2021.1.0 (mvnrepository.com)
>> <https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2021.1.0;
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Thu, 28 Sept 2023 at 14:51, Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> The same problem of postgres-jdbc compatibility remains and I pushed it
>>> to github - https://github.com/raaivore/APIexperiment.
>>>
>>> I am using Postgres 15 and Java 1.8 and Tomcat9.
>>> Maybe somebody can help me to solve the problem.
>>>
>>> Regards
>>> Raivo
>>>
>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 05:23 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-29 05:23 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: pgsql-general@lists.postgresql.org
But goes worst if I am using
postgis-geometry-2021.1.0.jar
Raivo
On Fri, Sep 29, 2023 at 8:14 AM Raivo Rebane <raivore55@gmail.com> wrote:
> It goes better, if I add postgis-geometry-2.5.0.jar and Eclipse founds
>
> import org.postgis.Point;
>
>
> Raivo
>
> On Fri, Sep 29, 2023 at 7:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> If I use this jar i give errors - Description Resource Path Location Type
>> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
>> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
>> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
>> Point cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 14 Java Problem
>> Point cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 35 Java Problem
>> Point cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
>> Point cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
>> Point cannot be resolved to a type ProcAddMushrooms.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 83 Java Problem
>> Point cannot be resolved to a type Utils.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 9 Java Problem
>> Point cannot be resolved to a type Utils.java
>> /KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
>>
>> Raivo
>>
>> On Thu, Sep 28, 2023 at 11:06 PM Dave Cramer <davecramer@postgres.rocks>
>> wrote:
>>
>>> The latest version of postgis-jdbc is Maven Repository: net.postgis »
>>> postgis-jdbc » 2021.1.0 (mvnrepository.com)
>>> <https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2021.1.0;
>>> Dave Cramer
>>> www.postgres.rocks
>>>
>>>
>>> On Thu, 28 Sept 2023 at 14:51, Raivo Rebane <raivore55@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> The same problem of postgres-jdbc compatibility remains and I pushed it
>>>> to github - https://github.com/raaivore/APIexperiment.
>>>>
>>>> I am using Postgres 15 and Java 1.8 and Tomcat9.
>>>> Maybe somebody can help me to solve the problem.
>>>>
>>>> Regards
>>>> Raivo
>>>>
>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 09:05 Raivo Rebane <raivore55@gmail.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-29 09:05 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Hi,
The code is :
package MushroomAPIs;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
@WebServlet("/AddMushrooms")
public class AddMushrooms extends HttpServlet implements
java.io.Serializable {
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
final String DB_URL = "jdbc:postgresql://localhost:5432/mushroom_database";
final String USER = "mushroomer";
final String PASSWORD = "";
Connection connection = null;
Timestamp LastModifiedTS = Timestamp.valueOf("1970-01-01 00:00:00");
try {
connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
// SQL päring vanima timestamp-i leidmiseks
String query = "SELECT timestamp AS oldest_timestamp FROM mushrooms";
PreparedStatement statement = connection.prepareStatement(query);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
Timestamp oldest_timestamp = resultSet.getTimestamp("oldest_timestamp");
if (oldest_timestamp.after(LastModifiedTS))
LastModifiedTS = oldest_timestamp;
}
System.out.println("Vanim timestamp: " + LastModifiedTS);
} catch (SQLException e) {
e.printStackTrace();
}
int count = ProcAddMushrooms.GetAddMushrooms(connection, LastModifiedTS);
response.getWriter().println("Added " + count + " mushrooms");
}
}
and available from github - https://github.com/raaivore/APIexperiment
May be somebody can help me to solve the problem ?
Raivo
On Fri, Sep 29, 2023 at 6:44 AM Ron <ronljohnsonjr@gmail.com> wrote:
> On 9/28/23 01:18, Raivo Rebane wrote:
>
> [snip]
>
> I made a new Java application Eclipse Dynamic WEB application and want to
> use Postgres - PostgreSQL 10.14
>
> [snip]
>
> What's wrong. Or is better to use more newer postgres. And then which
> jdbc-I need to use ?
>
>
> https://www.postgresql.org/support/versioning/
>
> Pg 10 will be EOL in *6 weeks*. Thus, "yes, use a newer version of
> Postgresql" (unless, like me, you're constrained by circumstances like "the
> business won't let us upgrade").
>
> Pg 15 and the latest JDBC are in the repositories:
> https://www.postgresql.org/download/
>
> --
> Born in Arizona, moved to Babylonia.
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 11:05 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-29 11:05 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org
Dave Cramer
www.postgres.rocks
On Fri, 29 Sept 2023 at 06:19, Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
>
> The code is :
> package MushroomAPIs;
>
> import java.io.IOException;
> import javax.servlet.ServletException;
> import javax.servlet.annotation.WebServlet;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.Timestamp;
>
> @WebServlet("/AddMushrooms")
> public class AddMushrooms extends HttpServlet implements
> java.io.Serializable {
> protected void doGet(HttpServletRequest request, HttpServletResponse
> response)
> throws ServletException, IOException {
>
> final String DB_URL = "jdbc:postgresql://localhost:5432/mushroom_database";
> final String USER = "mushroomer";
> final String PASSWORD = "";
>
> Connection connection = null;
> Timestamp LastModifiedTS = Timestamp.valueOf("1970-01-01 00:00:00");
>
> try {
> connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
>
> // SQL päring vanima timestamp-i leidmiseks
> String query = "SELECT timestamp AS oldest_timestamp FROM mushrooms";
> PreparedStatement statement = connection.prepareStatement(query);
> ResultSet resultSet = statement.executeQuery();
>
> while (resultSet.next()) {
> Timestamp oldest_timestamp = resultSet.getTimestamp("oldest_timestamp");
> if (oldest_timestamp.after(LastModifiedTS))
> LastModifiedTS = oldest_timestamp;
> }
> System.out.println("Vanim timestamp: " + LastModifiedTS);
>
> } catch (SQLException e) {
> e.printStackTrace();
> }
>
> int count = ProcAddMushrooms.GetAddMushrooms(connection, LastModifiedTS);
>
> response.getWriter().println("Added " + count + " mushrooms");
> }
> }
> and available from github - https://github.com/raaivore/APIexperiment
>
> May be somebody can help me to solve the problem ?
>
> Raivo
>
> On Fri, Sep 29, 2023 at 6:44 AM Ron <ronljohnsonjr@gmail.com> wrote:
>
>> On 9/28/23 01:18, Raivo Rebane wrote:
>>
>> [snip]
>>
>> I made a new Java application Eclipse Dynamic WEB application and want to
>> use Postgres - PostgreSQL 10.14
>>
>> [snip]
>>
>> What's wrong. Or is better to use more newer postgres. And then which
>> jdbc-I need to use ?
>>
>>
>> https://www.postgresql.org/support/versioning/
>>
>> Pg 10 will be EOL in *6 weeks*. Thus, "yes, use a newer version of
>> Postgresql" (unless, like me, you're constrained by circumstances like "the
>> business won't let us upgrade").
>>
>> Pg 15 and the latest JDBC are in the repositories:
>> https://www.postgresql.org/download/
>>
> --
>> Born in Arizona, moved to Babylonia.
>>
>
I loaded your project in IDEA and it was referring to jdk1.7
It also looks like you still have the postgis-geometry-2.5.0.jar in the
webapp/lib dir remove it
Dave
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 13:03 Raivo Rebane <raivore55@gmail.com>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-29 13:03 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org
I removed this recommended jar.
I am using Eclipse and there Java 1.8 is setted.
What I have to do ?
Raivo
On Fri, Sep 29, 2023 at 2:05 PM Dave Cramer <davecramer@postgres.rocks>
wrote:
>
> Dave Cramer
> www.postgres.rocks
>
>
> On Fri, 29 Sept 2023 at 06:19, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>>
>> The code is :
>> package MushroomAPIs;
>>
>> import java.io.IOException;
>> import javax.servlet.ServletException;
>> import javax.servlet.annotation.WebServlet;
>> import javax.servlet.http.HttpServlet;
>> import javax.servlet.http.HttpServletRequest;
>> import javax.servlet.http.HttpServletResponse;
>>
>> import java.sql.Connection;
>> import java.sql.DriverManager;
>> import java.sql.PreparedStatement;
>> import java.sql.ResultSet;
>> import java.sql.SQLException;
>> import java.sql.Timestamp;
>>
>> @WebServlet("/AddMushrooms")
>> public class AddMushrooms extends HttpServlet implements
>> java.io.Serializable {
>> protected void doGet(HttpServletRequest request, HttpServletResponse
>> response)
>> throws ServletException, IOException {
>>
>> final String DB_URL =
>> "jdbc:postgresql://localhost:5432/mushroom_database";
>> final String USER = "mushroomer";
>> final String PASSWORD = "";
>>
>> Connection connection = null;
>> Timestamp LastModifiedTS = Timestamp.valueOf("1970-01-01 00:00:00");
>>
>> try {
>> connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
>>
>> // SQL päring vanima timestamp-i leidmiseks
>> String query = "SELECT timestamp AS oldest_timestamp FROM mushrooms";
>> PreparedStatement statement = connection.prepareStatement(query);
>> ResultSet resultSet = statement.executeQuery();
>>
>> while (resultSet.next()) {
>> Timestamp oldest_timestamp = resultSet.getTimestamp("oldest_timestamp");
>> if (oldest_timestamp.after(LastModifiedTS))
>> LastModifiedTS = oldest_timestamp;
>> }
>> System.out.println("Vanim timestamp: " + LastModifiedTS);
>>
>> } catch (SQLException e) {
>> e.printStackTrace();
>> }
>>
>> int count = ProcAddMushrooms.GetAddMushrooms(connection, LastModifiedTS);
>>
>> response.getWriter().println("Added " + count + " mushrooms");
>> }
>> }
>> and available from github - https://github.com/raaivore/APIexperiment
>>
>> May be somebody can help me to solve the problem ?
>>
>> Raivo
>>
>> On Fri, Sep 29, 2023 at 6:44 AM Ron <ronljohnsonjr@gmail.com> wrote:
>>
>>> On 9/28/23 01:18, Raivo Rebane wrote:
>>>
>>> [snip]
>>>
>>> I made a new Java application Eclipse Dynamic WEB application and want
>>> to use Postgres - PostgreSQL 10.14
>>>
>>> [snip]
>>>
>>> What's wrong. Or is better to use more newer postgres. And then which
>>> jdbc-I need to use ?
>>>
>>>
>>> https://www.postgresql.org/support/versioning/
>>>
>>> Pg 10 will be EOL in *6 weeks*. Thus, "yes, use a newer version of
>>> Postgresql" (unless, like me, you're constrained by circumstances like "the
>>> business won't let us upgrade").
>>>
>>> Pg 15 and the latest JDBC are in the repositories:
>>> https://www.postgresql.org/download/
>>>
>> --
>>> Born in Arizona, moved to Babylonia.
>>>
>>
>
>
> I loaded your project in IDEA and it was referring to jdk1.7
> It also looks like you still have the postgis-geometry-2.5.0.jar in the
> webapp/lib dir remove it
>
> Dave
>
Attachments:
Screenshot 2023-09-29 160151.png (image/png, 55.0K) download
view image
Screenshot 2023-09-29 155531.png (image/png, 65.7K) download
view image
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 18:22 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-29 18:22 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org
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 ?
Raivo
On Fri, Sep 29, 2023 at 4:03 PM Raivo Rebane <raivore55@gmail.com> wrote:
> I removed this recommended jar.
> I am using Eclipse and there Java 1.8 is setted.
> What I have to do ?
>
> Raivo
>
> On Fri, Sep 29, 2023 at 2:05 PM Dave Cramer <davecramer@postgres.rocks>
> wrote:
>
>>
>> Dave Cramer
>> www.postgres.rocks
>>
>>
>> On Fri, 29 Sept 2023 at 06:19, Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> The code is :
>>> package MushroomAPIs;
>>>
>>> import java.io.IOException;
>>> import javax.servlet.ServletException;
>>> import javax.servlet.annotation.WebServlet;
>>> import javax.servlet.http.HttpServlet;
>>> import javax.servlet.http.HttpServletRequest;
>>> import javax.servlet.http.HttpServletResponse;
>>>
>>> import java.sql.Connection;
>>> import java.sql.DriverManager;
>>> import java.sql.PreparedStatement;
>>> import java.sql.ResultSet;
>>> import java.sql.SQLException;
>>> import java.sql.Timestamp;
>>>
>>> @WebServlet("/AddMushrooms")
>>> public class AddMushrooms extends HttpServlet implements
>>> java.io.Serializable {
>>> protected void doGet(HttpServletRequest request, HttpServletResponse
>>> response)
>>> throws ServletException, IOException {
>>>
>>> final String DB_URL =
>>> "jdbc:postgresql://localhost:5432/mushroom_database";
>>> final String USER = "mushroomer";
>>> final String PASSWORD = "";
>>>
>>> Connection connection = null;
>>> Timestamp LastModifiedTS = Timestamp.valueOf("1970-01-01 00:00:00");
>>>
>>> try {
>>> connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
>>>
>>> // SQL päring vanima timestamp-i leidmiseks
>>> String query = "SELECT timestamp AS oldest_timestamp FROM mushrooms";
>>> PreparedStatement statement = connection.prepareStatement(query);
>>> ResultSet resultSet = statement.executeQuery();
>>>
>>> while (resultSet.next()) {
>>> Timestamp oldest_timestamp = resultSet.getTimestamp("oldest_timestamp");
>>> if (oldest_timestamp.after(LastModifiedTS))
>>> LastModifiedTS = oldest_timestamp;
>>> }
>>> System.out.println("Vanim timestamp: " + LastModifiedTS);
>>>
>>> } catch (SQLException e) {
>>> e.printStackTrace();
>>> }
>>>
>>> int count = ProcAddMushrooms.GetAddMushrooms(connection, LastModifiedTS);
>>>
>>> response.getWriter().println("Added " + count + " mushrooms");
>>> }
>>> }
>>> and available from github - https://github.com/raaivore/APIexperiment
>>>
>>> May be somebody can help me to solve the problem ?
>>>
>>> Raivo
>>>
>>> On Fri, Sep 29, 2023 at 6:44 AM Ron <ronljohnsonjr@gmail.com> wrote:
>>>
>>>> On 9/28/23 01:18, Raivo Rebane wrote:
>>>>
>>>> [snip]
>>>>
>>>> I made a new Java application Eclipse Dynamic WEB application and want
>>>> to use Postgres - PostgreSQL 10.14
>>>>
>>>> [snip]
>>>>
>>>> What's wrong. Or is better to use more newer postgres. And then which
>>>> jdbc-I need to use ?
>>>>
>>>>
>>>> https://www.postgresql.org/support/versioning/
>>>>
>>>> Pg 10 will be EOL in *6 weeks*. Thus, "yes, use a newer version of
>>>> Postgresql" (unless, like me, you're constrained by circumstances like "the
>>>> business won't let us upgrade").
>>>>
>>>> Pg 15 and the latest JDBC are in the repositories:
>>>> https://www.postgresql.org/download/
>>>>
>>> --
>>>> Born in Arizona, moved to Babylonia.
>>>>
>>>
>>
>>
>> I loaded your project in IDEA and it was referring to jdk1.7
>> It also looks like you still have the postgis-geometry-2.5.0.jar in the
>> webapp/lib dir remove it
>>
>> Dave
>>
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 18:42 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 2 replies; 43+ messages in thread
From: Dave Cramer @ 2023-09-29 18:42 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org
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
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 19:43 postgresql439848@heinz-it.de
parent: Dave Cramer <davecramer@postgres.rocks>
1 sibling, 0 replies; 43+ messages in thread
From: postgresql439848@heinz-it.de @ 2023-09-29 19:43 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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.
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-29 19:43 Craig McIlwee <craigm@vt.edu>
parent: Dave Cramer <davecramer@postgres.rocks>
1 sibling, 1 reply; 43+ messages in thread
From: Craig McIlwee @ 2023-09-29 19:43 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
> for some reason the postgresql jar is not in the classpath.
This is due to the way that Tomcat loads drivers, which is documented at
[1]. In short, the JDBC driver should be placed in the tomcat/lib
directory and removed from the application's WEB-INF/lib directory. After
doing that, I was able to get past the "No suitable driver" exception.
OP, you should read that entire page, and in particular the portion at
[2]. By registering a "Resource" with Tomcat, you can let it manage a
connection pool for you (if you aren't already using something like
PgBouncer or pgpool) and, if registered at the container level, in the
future you can share that pool across all of your web applications in the
container.
[1]
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
[2]
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
Craig
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 05:01 Raivo Rebane <raivore55@gmail.com>
parent: Craig McIlwee <craigm@vt.edu>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 05:01 UTC (permalink / raw)
To: Craig McIlwee <craigm@vt.edu>; +Cc: pgsql-general@lists.postgresql.org
Hi,
I copied the postgres driver to Tomcat/lib.
PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib> dir post*
Directory: C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 28.09.2023 14:40 1081604 postgresql-42.6.0.jar
but Tomcat remains to give error -
java.sql.SQLException: No suitable driver found for
jdbc:postgresql://localhost:5432/mushroom_database
I am using Postgres 15. May be I have to use more older one ?
Raivo
On Sat, Sep 30, 2023 at 6:32 AM Craig McIlwee <craigm@vt.edu> wrote:
> > for some reason the postgresql jar is not in the classpath.
>
> This is due to the way that Tomcat loads drivers, which is documented at
> [1]. In short, the JDBC driver should be placed in the tomcat/lib
> directory and removed from the application's WEB-INF/lib directory. After
> doing that, I was able to get past the "No suitable driver" exception.
>
> OP, you should read that entire page, and in particular the portion at
> [2]. By registering a "Resource" with Tomcat, you can let it manage a
> connection pool for you (if you aren't already using something like
> PgBouncer or pgpool) and, if registered at the container level, in the
> future you can share that pool across all of your web applications in the
> container.
>
> [1]
> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
> [2]
> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
>
> Craig
>
>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 05:18 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 05:18 UTC (permalink / raw)
To: Craig McIlwee <craigm@vt.edu>; +Cc: pgsql-general@lists.postgresql.org
May be I have to copy PostGis draiver also to tomcat/lib ?
Raivo
On Sat, Sep 30, 2023 at 8:01 AM Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> I copied the postgres driver to Tomcat/lib.
> PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib> dir post*
> Directory: C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib
> Mode LastWriteTime Length Name
> ---- ------------- ------ ----
> -a---- 28.09.2023 14:40 1081604 postgresql-42.6.0.jar
> but Tomcat remains to give error -
> java.sql.SQLException: No suitable driver found for
> jdbc:postgresql://localhost:5432/mushroom_database
> I am using Postgres 15. May be I have to use more older one ?
>
>
> Raivo
>
> On Sat, Sep 30, 2023 at 6:32 AM Craig McIlwee <craigm@vt.edu> wrote:
>
>> > for some reason the postgresql jar is not in the classpath.
>>
>> This is due to the way that Tomcat loads drivers, which is documented at
>> [1]. In short, the JDBC driver should be placed in the tomcat/lib
>> directory and removed from the application's WEB-INF/lib directory. After
>> doing that, I was able to get past the "No suitable driver" exception.
>>
>> OP, you should read that entire page, and in particular the portion at
>> [2]. By registering a "Resource" with Tomcat, you can let it manage a
>> connection pool for you (if you aren't already using something like
>> PgBouncer or pgpool) and, if registered at the container level, in the
>> future you can share that pool across all of your web applications in the
>> container.
>>
>> [1]
>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
>> [2]
>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
>>
>> Craig
>>
>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 05:27 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 05:27 UTC (permalink / raw)
To: Craig McIlwee <craigm@vt.edu>; +Cc: pgsql-general@lists.postgresql.org
Sorry. I accidentally usin postgres 16, which was empty
Many thanks for advise !!!
Raivo
On Sat, Sep 30, 2023 at 8:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
> May be I have to copy PostGis draiver also to tomcat/lib ?
>
> Raivo
>
> On Sat, Sep 30, 2023 at 8:01 AM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>> I copied the postgres driver to Tomcat/lib.
>> PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib> dir post*
>> Directory: C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib
>> Mode LastWriteTime Length Name
>> ---- ------------- ------ ----
>> -a---- 28.09.2023 14:40 1081604 postgresql-42.6.0.jar
>> but Tomcat remains to give error -
>> java.sql.SQLException: No suitable driver found for
>> jdbc:postgresql://localhost:5432/mushroom_database
>> I am using Postgres 15. May be I have to use more older one ?
>>
>>
>> Raivo
>>
>> On Sat, Sep 30, 2023 at 6:32 AM Craig McIlwee <craigm@vt.edu> wrote:
>>
>>> > for some reason the postgresql jar is not in the classpath.
>>>
>>> This is due to the way that Tomcat loads drivers, which is documented at
>>> [1]. In short, the JDBC driver should be placed in the tomcat/lib
>>> directory and removed from the application's WEB-INF/lib directory. After
>>> doing that, I was able to get past the "No suitable driver" exception.
>>>
>>> OP, you should read that entire page, and in particular the portion at
>>> [2]. By registering a "Resource" with Tomcat, you can let it manage a
>>> connection pool for you (if you aren't already using something like
>>> PgBouncer or pgpool) and, if registered at the container level, in the
>>> future you can share that pool across all of your web applications in the
>>> container.
>>>
>>> [1]
>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
>>> [2]
>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
>>>
>>> Craig
>>>
>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 06:33 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 2 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 06:33 UTC (permalink / raw)
To: Craig McIlwee <craigm@vt.edu>; +Cc: pgsql-general@lists.postgresql.org
Hi,
sometimes I am lucky and don't get the old error, but sometime not.
I tried to use PreparedStatement, but I got error -
org.postgresql.util.PSQLException: Can't use query methods that take a
query string on a PreparedStatement.
at
org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
and java code is -
String deleteQuery = "DELETE FROM " + tableNam
System.out.println(deleteQuery);
PreparedStatement statement = connection.prepareStatement(deleteQuery);
May be it's easy for me to use normal statement ?
Raivo
On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com> wrote:
> Sorry. I accidentally usin postgres 16, which was empty
> Many thanks for advise !!!
>
> Raivo
>
> On Sat, Sep 30, 2023 at 8:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> May be I have to copy PostGis draiver also to tomcat/lib ?
>>
>> Raivo
>>
>> On Sat, Sep 30, 2023 at 8:01 AM Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Hi,
>>> I copied the postgres driver to Tomcat/lib.
>>> PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib> dir post*
>>> Directory: C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib
>>> Mode LastWriteTime Length Name
>>> ---- ------------- ------ ----
>>> -a---- 28.09.2023 14:40 1081604 postgresql-42.6.0.jar
>>> but Tomcat remains to give error -
>>> java.sql.SQLException: No suitable driver found for
>>> jdbc:postgresql://localhost:5432/mushroom_database
>>> I am using Postgres 15. May be I have to use more older one ?
>>>
>>>
>>> Raivo
>>>
>>> On Sat, Sep 30, 2023 at 6:32 AM Craig McIlwee <craigm@vt.edu> wrote:
>>>
>>>> > for some reason the postgresql jar is not in the classpath.
>>>>
>>>> This is due to the way that Tomcat loads drivers, which is documented
>>>> at [1]. In short, the JDBC driver should be placed in the tomcat/lib
>>>> directory and removed from the application's WEB-INF/lib directory. After
>>>> doing that, I was able to get past the "No suitable driver" exception.
>>>>
>>>> OP, you should read that entire page, and in particular the portion at
>>>> [2]. By registering a "Resource" with Tomcat, you can let it manage a
>>>> connection pool for you (if you aren't already using something like
>>>> PgBouncer or pgpool) and, if registered at the container level, in the
>>>> future you can share that pool across all of your web applications in the
>>>> container.
>>>>
>>>> [1]
>>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
>>>> [2]
>>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
>>>>
>>>> Craig
>>>>
>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 07:18 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 07:18 UTC (permalink / raw)
To: Craig McIlwee <craigm@vt.edu>; +Cc: pgsql-general@lists.postgresql.org
I fix previous error what was my bad knowledge,
But new error occur which is related to postgres postgis jars.
If You are kind to answer me more;
Java code is :
public static boolean CheckIsNewInMushrooms(Connection connection, Point
AddLocation, String AddDescription) {
boolean IsNew = true;
try {
String sqlQuery = "SELECT location, description FROM mushrooms";
try (PreparedStatement preparedStatement = connection.prepareStatement(
sqlQuery)) {
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
Point point = (Point) resultSet.getObject("location");
String description = resultSet.getString("description");
if (AddLocation.x == point.x && AddLocation.y == point.y && AddDescription
.equals(description))
IsNew = false;
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return IsNew;
}
and at line
Point point = (Point) resultSet.getObject("location");
java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast
to org.postgis.Point
at
MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45)
How to get Point from resultset ?
Is it related to postgis driver ?
Regards
Raivo
On Sat, Sep 30, 2023 at 9:33 AM Raivo Rebane <raivore55@gmail.com> wrote:
> Hi,
> sometimes I am lucky and don't get the old error, but sometime not.
>
> I tried to use PreparedStatement, but I got error -
> org.postgresql.util.PSQLException: Can't use query methods that take a
> query string on a PreparedStatement.
> at
> org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
> at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
> and java code is -
>
> String deleteQuery = "DELETE FROM " + tableNam
>
> System.out.println(deleteQuery);
>
> PreparedStatement statement = connection.prepareStatement(deleteQuery);
>
> May be it's easy for me to use normal statement ?
>
>
> Raivo
>
>
> On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Sorry. I accidentally usin postgres 16, which was empty
>> Many thanks for advise !!!
>>
>> Raivo
>>
>> On Sat, Sep 30, 2023 at 8:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> May be I have to copy PostGis draiver also to tomcat/lib ?
>>>
>>> Raivo
>>>
>>> On Sat, Sep 30, 2023 at 8:01 AM Raivo Rebane <raivore55@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>> I copied the postgres driver to Tomcat/lib.
>>>> PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib> dir post*
>>>> Directory: C:\Program Files\Apache Software Foundation\Tomcat
>>>> 9.0\lib
>>>> Mode LastWriteTime Length Name
>>>> ---- ------------- ------ ----
>>>> -a---- 28.09.2023 14:40 1081604 postgresql-42.6.0.jar
>>>> but Tomcat remains to give error -
>>>> java.sql.SQLException: No suitable driver found for
>>>> jdbc:postgresql://localhost:5432/mushroom_database
>>>> I am using Postgres 15. May be I have to use more older one ?
>>>>
>>>>
>>>> Raivo
>>>>
>>>> On Sat, Sep 30, 2023 at 6:32 AM Craig McIlwee <craigm@vt.edu> wrote:
>>>>
>>>>> > for some reason the postgresql jar is not in the classpath.
>>>>>
>>>>> This is due to the way that Tomcat loads drivers, which is documented
>>>>> at [1]. In short, the JDBC driver should be placed in the tomcat/lib
>>>>> directory and removed from the application's WEB-INF/lib directory. After
>>>>> doing that, I was able to get past the "No suitable driver" exception.
>>>>>
>>>>> OP, you should read that entire page, and in particular the portion at
>>>>> [2]. By registering a "Resource" with Tomcat, you can let it manage a
>>>>> connection pool for you (if you aren't already using something like
>>>>> PgBouncer or pgpool) and, if registered at the container level, in the
>>>>> future you can share that pool across all of your web applications in the
>>>>> container.
>>>>>
>>>>> [1]
>>>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
>>>>> [2]
>>>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
>>>>>
>>>>> Craig
>>>>>
>>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 07:51 postgresql439848@heinz-it.de
parent: Raivo Rebane <raivore55@gmail.com>
1 sibling, 1 reply; 43+ messages in thread
From: postgresql439848@heinz-it.de @ 2023-09-30 07:51 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Am 30.09.23 um 08:33 schrieb Raivo Rebane:
> Hi,
> sometimes I am lucky and don't get the old error, but sometime not.
>
> I tried to use PreparedStatement, but I got error -
> org.postgresql.util.PSQLException: Can't use query methods that take a
> query string on a PreparedStatement.
> at
> org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
> at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
> and java code is -
>
> String deleteQuery = "DELETE FROM " + tableNam
>
> System.out.println(deleteQuery);
>
> PreparedStatement statement = connection.prepareStatement(deleteQuery);
if your statement is already prepared with query, use
statement.exequte(); or statement.executeQuery() without querystring;
if you have a new statement without query, use execute and such with
query string.
>
> May be it's easy for me to use normal statement ?
>
>
> Raivo
>
>
> On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com> wrote:
[snip]
Am 30.09.23 um 09:18 schrieb Raivo Rebane:
> I fix previous error what was my bad knowledge,
> But new error occur which is related to postgres postgis jars.
> If You are kind to answer me more;
>
> Java code is :
>
> public static boolean CheckIsNewInMushrooms(Connection connection, Point
> AddLocation, String AddDescription) {
>
> boolean IsNew = true;
>
>
> try {
>
> String sqlQuery = "SELECT location, description FROM mushrooms";
>
> try (PreparedStatement preparedStatement = connection.prepareStatement(
> sqlQuery)) {
>
> ResultSet resultSet = preparedStatement.executeQuery();
>
>
> while (resultSet.next()) {
>
> Point point = (Point) resultSet.getObject("location");
>
> String description = resultSet.getString("description");
>
>
> if (AddLocation.x == point.x && AddLocation.y == point.y && AddDescription
> .equals(description))
>
> IsNew = false;
>
> }
>
> }
>
> } catch (SQLException e) {
>
> e.printStackTrace();
>
> }
>
>
> return IsNew;
>
> }
>
> and at line
>
> Point point = (Point) resultSet.getObject("location");
>
>
> java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast
> to org.postgis.Point
> at
> MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45)
> How to get Point from resultset ?
> Is it related to postgis driver ?
try another way to cast to Point.
look for the way over PGgeometry like here
https://postgis.net/docs/manual-3.3/ch07.html#idm3092
>
> Regards
> Raivo
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 08:10 Raivo Rebane <raivore55@gmail.com>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 0 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 08:10 UTC (permalink / raw)
To: Craig McIlwee <craigm@vt.edu>; +Cc: pgsql-general@lists.postgresql.org
It seems so, that if my WEB-INF/lib contains postgres driver then Tomcat
gives - No suitable driver found
Raivo
On Sat, Sep 30, 2023 at 10:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
> I fix previous error what was my bad knowledge,
> But new error occur which is related to postgres postgis jars.
> If You are kind to answer me more;
>
> Java code is :
>
> public static boolean CheckIsNewInMushrooms(Connection connection, Point
> AddLocation, String AddDescription) {
>
> boolean IsNew = true;
>
>
> try {
>
> String sqlQuery = "SELECT location, description FROM mushrooms";
>
> try (PreparedStatement preparedStatement = connection.prepareStatement(
> sqlQuery)) {
>
> ResultSet resultSet = preparedStatement.executeQuery();
>
>
> while (resultSet.next()) {
>
> Point point = (Point) resultSet.getObject("location");
>
> String description = resultSet.getString("description");
>
>
> if (AddLocation.x == point.x && AddLocation.y == point.y && AddDescription
> .equals(description))
>
> IsNew = false;
>
> }
>
> }
>
> } catch (SQLException e) {
>
> e.printStackTrace();
>
> }
>
>
> return IsNew;
>
> }
>
> and at line
>
> Point point = (Point) resultSet.getObject("location");
>
>
> java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast
> to org.postgis.Point
> at
> MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45)
> How to get Point from resultset ?
> Is it related to postgis driver ?
>
> Regards
> Raivo
>
> On Sat, Sep 30, 2023 at 9:33 AM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Hi,
>> sometimes I am lucky and don't get the old error, but sometime not.
>>
>> I tried to use PreparedStatement, but I got error -
>> org.postgresql.util.PSQLException: Can't use query methods that take a
>> query string on a PreparedStatement.
>> at
>> org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
>> at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
>> and java code is -
>>
>> String deleteQuery = "DELETE FROM " + tableNam
>>
>> System.out.println(deleteQuery);
>>
>> PreparedStatement statement = connection.prepareStatement(deleteQuery);
>>
>> May be it's easy for me to use normal statement ?
>>
>>
>> Raivo
>>
>>
>> On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> Sorry. I accidentally usin postgres 16, which was empty
>>> Many thanks for advise !!!
>>>
>>> Raivo
>>>
>>> On Sat, Sep 30, 2023 at 8:18 AM Raivo Rebane <raivore55@gmail.com>
>>> wrote:
>>>
>>>> May be I have to copy PostGis draiver also to tomcat/lib ?
>>>>
>>>> Raivo
>>>>
>>>> On Sat, Sep 30, 2023 at 8:01 AM Raivo Rebane <raivore55@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>> I copied the postgres driver to Tomcat/lib.
>>>>> PS C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib> dir
>>>>> post*
>>>>> Directory: C:\Program Files\Apache Software Foundation\Tomcat
>>>>> 9.0\lib
>>>>> Mode LastWriteTime Length Name
>>>>> ---- ------------- ------ ----
>>>>> -a---- 28.09.2023 14:40 1081604 postgresql-42.6.0.jar
>>>>> but Tomcat remains to give error -
>>>>> java.sql.SQLException: No suitable driver found for
>>>>> jdbc:postgresql://localhost:5432/mushroom_database
>>>>> I am using Postgres 15. May be I have to use more older one ?
>>>>>
>>>>>
>>>>> Raivo
>>>>>
>>>>> On Sat, Sep 30, 2023 at 6:32 AM Craig McIlwee <craigm@vt.edu> wrote:
>>>>>
>>>>>> > for some reason the postgresql jar is not in the classpath.
>>>>>>
>>>>>> This is due to the way that Tomcat loads drivers, which is documented
>>>>>> at [1]. In short, the JDBC driver should be placed in the tomcat/lib
>>>>>> directory and removed from the application's WEB-INF/lib directory. After
>>>>>> doing that, I was able to get past the "No suitable driver" exception.
>>>>>>
>>>>>> OP, you should read that entire page, and in particular the portion
>>>>>> at [2]. By registering a "Resource" with Tomcat, you can let it manage a
>>>>>> connection pool for you (if you aren't already using something like
>>>>>> PgBouncer or pgpool) and, if registered at the container level, in the
>>>>>> future you can share that pool across all of your web applications in the
>>>>>> container.
>>>>>>
>>>>>> [1]
>>>>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_serv...
>>>>>> [2]
>>>>>> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL
>>>>>>
>>>>>> Craig
>>>>>>
>>>>>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 10:49 Raivo Rebane <raivore55@gmail.com>
parent: postgresql439848@heinz-it.de
0 siblings, 1 reply; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 10:49 UTC (permalink / raw)
To: postgresql439848@heinz-it.de; +Cc: pgsql-general@lists.postgresql.org
Thanks for very much for help.
It seems that I can do the test project for new job.
In future I use help of chat.gpt
Regards
Raivo
On Sat, Sep 30, 2023 at 11:15 AM <postgresql439848@heinz-it.de> wrote:
> Am 30.09.23 um 08:33 schrieb Raivo Rebane:
> > Hi,
> > sometimes I am lucky and don't get the old error, but sometime not.
> >
> > I tried to use PreparedStatement, but I got error -
> > org.postgresql.util.PSQLException: Can't use query methods that take a
> > query string on a PreparedStatement.
> > at
> >
> org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
> > at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
> > and java code is -
> >
> > String deleteQuery = "DELETE FROM " + tableNam
> >
> > System.out.println(deleteQuery);
> >
> > PreparedStatement statement = connection.prepareStatement(deleteQuery);
> if your statement is already prepared with query, use
> statement.exequte(); or statement.executeQuery() without querystring;
> if you have a new statement without query, use execute and such with
> query string.
> >
> > May be it's easy for me to use normal statement ?
> >
> >
> > Raivo
> >
> >
> > On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com>
> wrote:
> [snip]
>
>
> Am 30.09.23 um 09:18 schrieb Raivo Rebane:
> > I fix previous error what was my bad knowledge,
> > But new error occur which is related to postgres postgis jars.
> > If You are kind to answer me more;
> >
> > Java code is :
> >
> > public static boolean CheckIsNewInMushrooms(Connection connection, Point
> > AddLocation, String AddDescription) {
> >
> > boolean IsNew = true;
> >
> >
> > try {
> >
> > String sqlQuery = "SELECT location, description FROM mushrooms";
> >
> > try (PreparedStatement preparedStatement = connection.prepareStatement(
> > sqlQuery)) {
> >
> > ResultSet resultSet = preparedStatement.executeQuery();
> >
> >
> > while (resultSet.next()) {
> >
> > Point point = (Point) resultSet.getObject("location");
> >
> > String description = resultSet.getString("description");
> >
> >
> > if (AddLocation.x == point.x && AddLocation.y == point.y &&
> AddDescription
> > .equals(description))
> >
> > IsNew = false;
> >
> > }
> >
> > }
> >
> > } catch (SQLException e) {
> >
> > e.printStackTrace();
> >
> > }
> >
> >
> > return IsNew;
> >
> > }
> >
> > and at line
> >
> > Point point = (Point) resultSet.getObject("location");
> >
> >
> > java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast
> > to org.postgis.Point
> > at
> >
> MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45)
> > How to get Point from resultset ?
> > Is it related to postgis driver ?
> try another way to cast to Point.
> look for the way over PGgeometry like here
> https://postgis.net/docs/manual-3.3/ch07.html#idm3092
> >
> > Regards
> > Raivo
>
>
>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 10:53 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 1 reply; 43+ messages in thread
From: Dave Cramer @ 2023-09-30 10:53 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: postgresql439848@heinz-it.de; pgsql-general@lists.postgresql.org
Again, can you please post the solution so others can learn as well ?
Dave Cramer
www.postgres.rocks
On Sat, 30 Sept 2023 at 06:49, Raivo Rebane <raivore55@gmail.com> wrote:
> Thanks for very much for help.
> It seems that I can do the test project for new job.
> In future I use help of chat.gpt
>
> Regards
> Raivo
>
> On Sat, Sep 30, 2023 at 11:15 AM <postgresql439848@heinz-it.de> wrote:
>
>> Am 30.09.23 um 08:33 schrieb Raivo Rebane:
>> > Hi,
>> > sometimes I am lucky and don't get the old error, but sometime not.
>> >
>> > I tried to use PreparedStatement, but I got error -
>> > org.postgresql.util.PSQLException: Can't use query methods that take a
>> > query string on a PreparedStatement.
>> > at
>> >
>> org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
>> > at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
>> > and java code is -
>> >
>> > String deleteQuery = "DELETE FROM " + tableNam
>> >
>> > System.out.println(deleteQuery);
>> >
>> > PreparedStatement statement = connection.prepareStatement(deleteQuery);
>> if your statement is already prepared with query, use
>> statement.exequte(); or statement.executeQuery() without querystring;
>> if you have a new statement without query, use execute and such with
>> query string.
>> >
>> > May be it's easy for me to use normal statement ?
>> >
>> >
>> > Raivo
>> >
>> >
>> > On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com>
>> wrote:
>> [snip]
>>
>>
>> Am 30.09.23 um 09:18 schrieb Raivo Rebane:
>> > I fix previous error what was my bad knowledge,
>> > But new error occur which is related to postgres postgis jars.
>> > If You are kind to answer me more;
>> >
>> > Java code is :
>> >
>> > public static boolean CheckIsNewInMushrooms(Connection connection, Point
>> > AddLocation, String AddDescription) {
>> >
>> > boolean IsNew = true;
>> >
>> >
>> > try {
>> >
>> > String sqlQuery = "SELECT location, description FROM mushrooms";
>> >
>> > try (PreparedStatement preparedStatement = connection.prepareStatement(
>> > sqlQuery)) {
>> >
>> > ResultSet resultSet = preparedStatement.executeQuery();
>> >
>> >
>> > while (resultSet.next()) {
>> >
>> > Point point = (Point) resultSet.getObject("location");
>> >
>> > String description = resultSet.getString("description");
>> >
>> >
>> > if (AddLocation.x == point.x && AddLocation.y == point.y &&
>> AddDescription
>> > .equals(description))
>> >
>> > IsNew = false;
>> >
>> > }
>> >
>> > }
>> >
>> > } catch (SQLException e) {
>> >
>> > e.printStackTrace();
>> >
>> > }
>> >
>> >
>> > return IsNew;
>> >
>> > }
>> >
>> > and at line
>> >
>> > Point point = (Point) resultSet.getObject("location");
>> >
>> >
>> > java.lang.ClassCastException: org.postgresql.util.PGobject cannot be
>> cast
>> > to org.postgis.Point
>> > at
>> >
>> MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45)
>> > How to get Point from resultset ?
>> > Is it related to postgis driver ?
>> try another way to cast to Point.
>> look for the way over PGgeometry like here
>> https://postgis.net/docs/manual-3.3/ch07.html#idm3092
>> >
>> > Regards
>> > Raivo
>>
>>
>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-09-30 11:51 Raivo Rebane <raivore55@gmail.com>
parent: Dave Cramer <davecramer@postgres.rocks>
0 siblings, 0 replies; 43+ messages in thread
From: Raivo Rebane @ 2023-09-30 11:51 UTC (permalink / raw)
To: Dave Cramer <davecramer@postgres.rocks>; +Cc: postgresql439848@heinz-it.de; pgsql-general@lists.postgresql.org
I have put it to github in the old place -
https://github.com/raaivore/APIexperiment.git
Raivo
On Sat, Sep 30, 2023 at 1:53 PM Dave Cramer <davecramer@postgres.rocks>
wrote:
> Again, can you please post the solution so others can learn as well ?
>
> Dave Cramer
> www.postgres.rocks
>
>
> On Sat, 30 Sept 2023 at 06:49, Raivo Rebane <raivore55@gmail.com> wrote:
>
>> Thanks for very much for help.
>> It seems that I can do the test project for new job.
>> In future I use help of chat.gpt
>>
>> Regards
>> Raivo
>>
>> On Sat, Sep 30, 2023 at 11:15 AM <postgresql439848@heinz-it.de> wrote:
>>
>>> Am 30.09.23 um 08:33 schrieb Raivo Rebane:
>>> > Hi,
>>> > sometimes I am lucky and don't get the old error, but sometime not.
>>> >
>>> > I tried to use PreparedStatement, but I got error -
>>> > org.postgresql.util.PSQLException: Can't use query methods that take a
>>> > query string on a PreparedStatement.
>>> > at
>>> >
>>> org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:145)
>>> > at MushroomAPIs.Clean.deleteAllRecordsFromTable(Clean.java:34)
>>> > and java code is -
>>> >
>>> > String deleteQuery = "DELETE FROM " + tableNam
>>> >
>>> > System.out.println(deleteQuery);
>>> >
>>> > PreparedStatement statement = connection.prepareStatement(deleteQuery);
>>> if your statement is already prepared with query, use
>>> statement.exequte(); or statement.executeQuery() without querystring;
>>> if you have a new statement without query, use execute and such with
>>> query string.
>>> >
>>> > May be it's easy for me to use normal statement ?
>>> >
>>> >
>>> > Raivo
>>> >
>>> >
>>> > On Sat, Sep 30, 2023 at 8:27 AM Raivo Rebane <raivore55@gmail.com>
>>> wrote:
>>> [snip]
>>>
>>>
>>> Am 30.09.23 um 09:18 schrieb Raivo Rebane:
>>> > I fix previous error what was my bad knowledge,
>>> > But new error occur which is related to postgres postgis jars.
>>> > If You are kind to answer me more;
>>> >
>>> > Java code is :
>>> >
>>> > public static boolean CheckIsNewInMushrooms(Connection connection,
>>> Point
>>> > AddLocation, String AddDescription) {
>>> >
>>> > boolean IsNew = true;
>>> >
>>> >
>>> > try {
>>> >
>>> > String sqlQuery = "SELECT location, description FROM mushrooms";
>>> >
>>> > try (PreparedStatement preparedStatement = connection.prepareStatement(
>>> > sqlQuery)) {
>>> >
>>> > ResultSet resultSet = preparedStatement.executeQuery();
>>> >
>>> >
>>> > while (resultSet.next()) {
>>> >
>>> > Point point = (Point) resultSet.getObject("location");
>>> >
>>> > String description = resultSet.getString("description");
>>> >
>>> >
>>> > if (AddLocation.x == point.x && AddLocation.y == point.y &&
>>> AddDescription
>>> > .equals(description))
>>> >
>>> > IsNew = false;
>>> >
>>> > }
>>> >
>>> > }
>>> >
>>> > } catch (SQLException e) {
>>> >
>>> > e.printStackTrace();
>>> >
>>> > }
>>> >
>>> >
>>> > return IsNew;
>>> >
>>> > }
>>> >
>>> > and at line
>>> >
>>> > Point point = (Point) resultSet.getObject("location");
>>> >
>>> >
>>> > java.lang.ClassCastException: org.postgresql.util.PGobject cannot be
>>> cast
>>> > to org.postgis.Point
>>> > at
>>> >
>>> MushroomAPIs.ProcAddMushrooms.CheckIsNewInMushrooms(ProcAddMushrooms.java:45)
>>> > How to get Point from resultset ?
>>> > Is it related to postgis driver ?
>>> try another way to cast to Point.
>>> look for the way over PGgeometry like here
>>> https://postgis.net/docs/manual-3.3/ch07.html#idm3092
>>> >
>>> > Regards
>>> > Raivo
>>>
>>>
>>>
^ permalink raw reply [nested|flat] 43+ messages in thread
* Re: Right version of jdbc
@ 2023-11-09 13:12 Dave Cramer <davecramer@postgres.rocks>
parent: Raivo Rebane <raivore55@gmail.com>
0 siblings, 0 replies; 43+ messages in thread
From: Dave Cramer @ 2023-11-09 13:12 UTC (permalink / raw)
To: Raivo Rebane <raivore55@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On Fri, 29 Sept 2023 at 01:23, Raivo Rebane <raivore55@gmail.com> wrote:
> But goes worst if I am using
> postgis-geometry-2021.1.0.jar
>
> Raivo
>
> On Fri, Sep 29, 2023 at 8:14 AM Raivo Rebane <raivore55@gmail.com> wrote:
>
>> It goes better, if I add postgis-geometry-2.5.0.jar and Eclipse founds
>>
>> import org.postgis.Point;
>>
>>
>> Raivo
>>
>> On Fri, Sep 29, 2023 at 7:18 AM Raivo Rebane <raivore55@gmail.com> wrote:
>>
>>> If I use this jar i give errors - Description Resource Path Location Type
>>> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
>>> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
>>> PGgeometry cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 46 Java Problem
>>> Point cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 14 Java Problem
>>> Point cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 35 Java Problem
>>> Point cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
>>> Point cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 47 Java Problem
>>> Point cannot be resolved to a type ProcAddMushrooms.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 83 Java Problem
>>> Point cannot be resolved to a type Utils.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 9 Java Problem
>>> Point cannot be resolved to a type Utils.java
>>> /KatseAPIs/src/main/java/MushroomAPIs line 22 Java Problem
>>>
>>> Raivo
>>>
>>> On Thu, Sep 28, 2023 at 11:06 PM Dave Cramer <davecramer@postgres.rocks>
>>> wrote:
>>>
>>>> The latest version of postgis-jdbc is Maven Repository: net.postgis »
>>>> postgis-jdbc » 2021.1.0 (mvnrepository.com)
>>>> <https://mvnrepository.com/artifact/net.postgis/postgis-jdbc/2021.1.0;
>>>> Dave Cramer
>>>> www.postgres.rocks
>>>>
>>>>
>>>> On Thu, 28 Sept 2023 at 14:51, Raivo Rebane <raivore55@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The same problem of postgres-jdbc compatibility remains and I pushed
>>>>> it to github - https://github.com/raaivore/APIexperiment.
>>>>>
>>>>> I am using Postgres 15 and Java 1.8 and Tomcat9.
>>>>> Maybe somebody can help me to solve the problem.
>>>>>
>>>>> Regards
>>>>> Raivo
>>>>>
>>>>
Sorry, I just realized I dropped the ball here. Did you ever figure this
out ?
Dave
^ permalink raw reply [nested|flat] 43+ messages in thread
end of thread, other threads:[~2023-11-09 13:12 UTC | newest]
Thread overview: 43+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 08:36 Right version of jdbc Raivo Rebane <raivore55@gmail.com>
2023-09-25 08:40 ` Thomas Kellerer <shammat@gmx.net>
2023-09-25 11:27 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-25 11:29 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-25 12:26 ` Raivo Rebane <raivore55@gmail.com>
2023-09-25 12:27 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-25 12:38 ` Raivo Rebane <raivore55@gmail.com>
2023-09-25 12:43 ` Raivo Rebane <raivore55@gmail.com>
2023-09-25 12:50 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-25 16:42 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-25 16:03 ` Rob Sargent <robjsargent@gmail.com>
2023-09-25 13:30 Re: Right version of jdbc Dave Cramer <davecramer@postgres.rocks>
2023-09-27 09:43 Re: Right version of jdbc Dave Cramer <davecramer@postgres.rocks>
2023-09-28 06:18 ` Raivo Rebane <raivore55@gmail.com>
2023-09-28 09:32 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-28 15:41 ` Raivo Rebane <raivore55@gmail.com>
2023-09-28 15:48 ` Rob Sargent <robjsargent@gmail.com>
2023-09-28 15:53 ` Raivo Rebane <raivore55@gmail.com>
2023-09-28 16:50 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-28 20:38 ` Ron <ronljohnsonjr@gmail.com>
2023-09-29 09:05 ` Raivo Rebane <raivore55@gmail.com>
2023-09-29 11:05 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-29 13:03 ` Raivo Rebane <raivore55@gmail.com>
2023-09-29 18:22 ` Raivo Rebane <raivore55@gmail.com>
2023-09-29 18:42 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-29 19:43 ` postgresql439848@heinz-it.de
2023-09-29 19:43 ` Craig McIlwee <craigm@vt.edu>
2023-09-30 05:01 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 05:18 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 05:27 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 06:33 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 07:18 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 08:10 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 07:51 ` postgresql439848@heinz-it.de
2023-09-30 10:49 ` Raivo Rebane <raivore55@gmail.com>
2023-09-30 10:53 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-30 11:51 ` Raivo Rebane <raivore55@gmail.com>
2023-09-28 18:51 Right version of jdbc Raivo Rebane <raivore55@gmail.com>
2023-09-28 20:06 ` Dave Cramer <davecramer@postgres.rocks>
2023-09-29 04:18 ` Raivo Rebane <raivore55@gmail.com>
2023-09-29 05:14 ` Raivo Rebane <raivore55@gmail.com>
2023-09-29 05:23 ` Raivo Rebane <raivore55@gmail.com>
2023-11-09 13:12 ` Dave Cramer <davecramer@postgres.rocks>
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