From: | Axel Tischer <axel(at)gmx(dot)ch> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Trouble !! |
Date: | 2002-01-30 19:44:39 |
Message-ID: | 3C584D27.3090608@gmx.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi there
The following error ocurred:
# java -cp /usr/share/pgsql/jdbc7.1-1.2.jar:. pgConnect
Something unusual has occured to cause the driver to fail. Please report
this exception: java.lang.NullPointerException
at org.postgresql.Driver.connect(Driver.java:125)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at pgConnect.connect(pgConnect.java:29)
at pgConnect.main(pgConnect.java:42)
-------------------
My java is:
# java -version
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
--------------------
My code looks like:
public class pgConnect {
private String driver="org.postgresql.Driver";
/** Creates new pgConnect */
public pgConnect() throws Exception {
}
public pgConnect(String drv) throws Exception {
driver=drv;
}
public Connection connect(String url,String usr,String passwd)
throws Exception {
if(driver!=null) {
Class.forName(driver);
}
Connection con= DriverManager.getConnection(url, usr, passwd);
return con;
}
public void disconnect(Connection con) throws SQLException {
con.close();
}
public static void main(String[] args) {
try {
String url="jdbc:postgresql://localhost:5432:/ebtacdb";
String user="axel";
pgConnect pc=new pgConnect();
pc.connect(url,user,"");
}
catch(Exception e) {
e.printStackTrace();
}
}
}
####
Do you have any idea ?
Thanks 4 help
Axel
From | Date | Subject | |
---|---|---|---|
Next Message | Rene Pijlman | 2002-01-30 20:31:34 | Re: JDBC batching |
Previous Message | tony | 2002-01-30 17:28:01 | tomcat update |