Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTBQV-0001Ml-46 for pgsql-jdbc@arkaria.postgresql.org; Thu, 27 Mar 2014 14:37:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WTBQU-0008Md-Cr for pgsql-jdbc@arkaria.postgresql.org; Thu, 27 Mar 2014 14:37:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTBQT-0008MW-Ci for pgsql-jdbc@postgresql.org; Thu, 27 Mar 2014 14:37:01 +0000 Received: from smtpout3.laposte.net ([193.253.67.228] helo=smtpout.laposte.net) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTBQQ-0007cl-B0 for pgsql-jdbc@postgresql.org; Thu, 27 Mar 2014 14:37:01 +0000 Received: from wwinf8223 ([10.99.54.222]) by mwinf8506-out with ME id iecw1n00C4nfl4A03ecw4n; Thu, 27 Mar 2014 15:36:56 +0100 Date: Thu, 27 Mar 2014 15:36:56 +0100 From: tim.lambrechts@laposte.net Reply-To: tim.lambrechts@laposte.net To: pgsql-jdbc@postgresql.org Message-ID: <1720810354.91914.1395931016609.JavaMail.www@wwinf8223> Subject: bug - connection problem with jdk 1.7 ? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_91913_1056786492.1395931016608" X-Originating-IP: [93.11.241.225] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-REPLYTO: |~| X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org ------=_Part_91913_1056786492.1395931016608 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable (I send this e-mail again, because I hadn't subscribed me to the mailing li= st) Hello, =C2=A0I already presented on the devshed forum a connection problem to post= gresql with the jdbc jar file postgresql-9.3-1100.jdbc41.jar. Nobody answer= ed me. Until recently I thought that the origin of the problem was maybe Eclipse, = but now I have tested the same code with a recent version of another develo= pment tool, Intellij IDEA, and the problem is still the same. That=E2=80=99s why I begin to think that the postgresql-9.3-1100.jdbc41.jar= file doesn=E2=80=99t function correctly with the jdk 1.7 (version 51.0), m= oreover because the same code worked very well with jdk 1.6, postgresql 9.0= and postgresql-9.0-801.jdbc4.jar. So, now I repeat the explanation of the jdbc connection problem that I gave= on the devshed forum: Recently I bought a new computer and installed a running project with upgra= ded versions of windows (windows 7, 64 bit), eclipse (4.3.1), java (jdk 1.7= : 51.0), postgresql (9.3) and jdbc (postgresql-9.3-1100.jdbc41.jar). On the older versions the programs ran without any problem, but now there i= s an exception in the following code: public static final String DBURL =3D "jdbc:postgresql:MR"; public static final String DBUSER =3D "postgres"; . . . public static Connection createConnection () throws SQLException { Properties props =3D new Properties(); props.setProperty("user",DBUSER); return DriverManager.getConnection(DBURL, props); } . . . A NullPointerException occurs on the line of the return, while DriverManage= r.getConnection(String, Properties) normally throws an SQLException. In debugging mode the stackTrace of Throwable e says: =E2=80=9Corg.eclipse.= debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has no= t been loaded occurred while retrieving component type of array.=E2=80=9D The jar file is included in the build path of eclipse and the .classpath fi= le is the same as before. It also contains the node . The Eclipse build wor= ks well and all the class files of the jar file can be opened and read. The API documentation for the DriverManager class says: =E2=80=9CJDBC 4.0 D= rivers must include the file META-INF/services/java.sql.Driver. This file c= ontains the name of the JDBC drivers implementation of java.sql.Driver.=E2= =80=9D When looking in the postgresql-9.3-1100.jdbc41.jar file in Eclipse the META= -INF/services/java.sql.Driver file shows one line: org.postgresql.Driver. T= he package org.postgresql contains the Driver.class file. In the same way, in the Intellij development tool everything seems to be ok= , until a NullPointerException is thrown on the same line: return DriverManager.getConnection(DBURL, props); Sorry, if this is not a bug, but until now I have had no help from postrgre= sql community and I'm quite stuck with this problem. Cheers. Tim =C2=A0 ------=_Part_91913_1056786492.1395931016608 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable (I send this e-mail again, because I hadn't subscribed me to the mailing li= st)

Hello,

 I already presented on the devshed = forum a connection problem to postgresql with the jdbc jar file postgresql= -9.3-1100.jdbc41.jar. Nobody answered me.

Until recently I thou= ght that the origin of the problem was maybe Eclipse, but now I have teste= d the same code with a recent version of another development tool, Intelli= j IDEA, and the problem is still the same.

That’s why I= begin to think that the postgresql-9.3-1100.jdbc41.jar file doesn’t= function correctly with the jdk 1.7 (version 51.0), moreover because the = same code worked very well with jdk 1.6, postgresql 9.0 and postgresql-9.0= -801.jdbc4.jar.

So, now I repeat the explanation of the jdbc c= onnection problem that I gave on the devshed forum:

Recently I= bought a new computer and installed a running project with upgraded versi= ons of windows (windows 7, 64 bit), eclipse (4.3.1), java (jdk 1.7 : 51.0)= , postgresql (9.3) and jdbc (postgresql-9.3-1100.jdbc41.jar).

= On the older versions the programs ran without any problem, but now there = is an exception in the following code:

=09public static final = String DBURL =3D "jdbc:postgresql:MR";
=09public static fin= al String DBUSER =3D "postgres";

=09. . .

public static Connection createConnection () throws SQLException= {
=09=09Properties props =3D new Properties();
=09=09props.set= Property("user",DBUSER);
=09=09return DriverManager.getConn= ection(DBURL, props);
=09}

=09. . .


= A NullPointerException occurs on the line of the return, while DriverManag= er.getConnection(String, Properties) normally throws an SQLException.

In debugging mode the stackTrace of Throwable e says: “org.= eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Ty= pe has not been loaded occurred while retrieving component type of array.&= rdquo;

The jar file is included in the build path of eclipse = and the .classpath file is the same as before. It also contains the node = . The Eclipse build works well and all the class files of the jar file can= be opened and read.

The API documentation for the DriverManag= er class says: “JDBC 4.0 Drivers must include the file META-INF/serv= ices/java.sql.Driver. This file contains the name of the JDBC drivers impl= ementation of java.sql.Driver.”
When looking in the postgres= ql-9.3-1100.jdbc41.jar file in Eclipse the META-INF/services/java.sql.Driv= er file shows one line: org.postgresql.Driver. The package org.postgresql = contains the Driver.class file.

In the same way, in the Intel= lij development tool everything seems to be ok, until a NullPointerExcepti= on is thrown on the same line:
return DriverManager.getConnection(DBU= RL, props);

Sorry, if this is not a bug, but until now I have h= ad no help from postrgresql community and I'm quite stuck with this problem= .

Cheers.

Tim

 


------=_Part_91913_1056786492.1395931016608--