Thread: Fwd: Rocks 6.1.1 with JDBC connection - What should be wrong?

Fwd: Rocks 6.1.1 with JDBC connection - What should be wrong?

From
Luciana Campos
Date:
Hello,

I am having trouble configuring JDBC4 with Rocks 6.1.1.
It's possible to connect database with 'psql', but using the JDBC
connection, I got this error:

Exception in thread "main"
java.lang.NoClassDefFoundError: org/postgresql/jdbc4/Jdbc4Connection
at org.postgresql.Driver.makeConnection(Driver.java:410)
at org.postgresql.Driver.connect(Driver.java:280)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at testaconexao.TestaConexao.main(TestaConexao.java:40)
Caused by: java.lang.ClassNotFoundException:
org.postgresql.jdbc4.Jdbc4Connection
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 5 more
Caused by: java.io.EOFException: Detect premature EOF
at sun.misc.Resource.getBytes(Resource.java:131)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:444)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
... 10 more

I'm using :

   - JAVA J2SE

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)


   - PostgreSQL

PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7
20120
313 (Red Hat 4.4.7-4), 64-bit


   - JDBC4

postgresql-9.2-1004.jdbc41.jar


What should be wrong?

Luciana.

Re: Fwd: Rocks 6.1.1 with JDBC connection - What should be wrong?

From
John R Pierce
Date:
On 11/25/2014 7:18 AM, Luciana Campos wrote:
> I am having trouble configuring JDBC4 with Rocks 6.1.1.
> It's possible to connect database with 'psql', but using the JDBC
> connection, I got this error:
>
> Exception in thread "main"
> java.lang.NoClassDefFoundError: org/postgresql/jdbc4/Jdbc4Connection
> .....
> postgresql-9.2-1004.jdbc41.jar

thats not the latest driver,
http://jdbc.postgresql.org/download/postgresql-9.3-1102.jdbc41.jar is.
ignore the 9.3 vs 9.2, they are the same thing.   1104 is the current
version.


--
john r pierce                                      37N 122W
somewhere on the middle of the left coast