Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » jdbc connection problem(I can't connect to postgresql using jdbc)
jdbc connection problem [message #1250591] Wed, 19 February 2014 11:37
Tim Lambrechts is currently offline Tim LambrechtsFriend
Messages: 1
Registered: February 2014
Junior Member
Hello,

Recently I bought a new computer and installed a running project with upgraded versions of windows (windows 7, 64 bit), eclipse (Kepler Service Release 1, 2013), java (jdk 1.7 : 51.0), postgresql (9.3) and jdbc (postgresql-9.3-1100.jdbc41.jar).

On the older versions the programs ran perfectly, but now there is an exception in the following code:

public static final String DBURL = "jdbc:postgresql:MR";
public static final String DBUSER = "postgres";

. . .

public static Connection createConnection () throws SQLException {
Properties props = new Properties();
props.setProperty("user",DBUSER);
return DriverManager.getConnection(DBURL, props);
}

. . .


A NullPointerException occurs on the line of the return, while DriverManager.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: Type has not been loaded occurred while retrieving component type of array."

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 <classpathentry kind="lib" path= C:/Users/User/Documents/Dev/Postgresql/ postgresql-9.3-1100.jdbc41.jar />. The Eclipse build works well.

The API documentation for the DriverManager class says: "JDBC 4.0 Drivers must include the file META-INF/services/java.sql.Driver. This file contains the name of the JDBC drivers implementation of java.sql.Driver."
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. The package org.postgresql contains the Driver.class file.

Can anybody explain what has to be done to solve the problem?

Cheers.

Tim
Previous Topic:Creating project with eclipse
Next Topic:Eclipse Juno update axis 1.4 to 1.6.2
Goto Forum:
  


Current Time: Wed Apr 24 15:19:38 GMT 2024

Powered by FUDForum. Page generated in 0.02882 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top