java.lang.NullPointerException

From: "Kevin W(dot) Nikiforuk" <kwn(at)sethanon(dot)remote(dot)ualberta(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: java.lang.NullPointerException
Date: 1998-05-20 19:09:22
Message-ID: Pine.LNX.3.95.980520125601.5353A-100000@sethanon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----

Forgive me if this is the wrong mailing list for this, but it seemed the
most appropriate.

I've got a database up and running under PostgreSQL called kwn. When I
try to use the following Java code to connect to it:

try {
Class.forName("postgresql.Driver");
}
catch (Exception e) {
System.out.println(e);
}

postgresql.Connection conn = null;

try {
conn =
(postgresql.Connection)DriverManager.getConnection("jdbc:postgresql:kwn");
}
catch (Exception e) {
System.out.println(e);
e.printStackTrace();
}

I get the following stack trace from the second try block:

java.lang.NullPointerException:
java.lang.NullPointerException:
at java.lang.String.<init>(String.java)
at postgresql.Connection.<init>(Connection.java:71)
at postgresql.Driver.connect(Driver.java:87)
at java.sql.DriverManager.getConnection(DriverManager.java:91)
at java.sql.DriverManager.getConnection(DriverManager.java:149)
at CookBook.<init>(CookBook.java:165)
at CookBook.main(CookBook.java:335)

==============================================================================

The program was compiled with the command line:

javac -d . -classpath /usr/share/java/postgresql.jar:/usr/lib/jdk-1.1.3/classes.zip:. test.java

and my CLASSPATH env variable is:
/usr/lib/jdk-1.1.3/lib/classes.zip:/usr/share/java/postgresql.jar:.

As far as I can tell, the Class.forName() call doesn't throw any
exceptions.

Ideas, hints or suggestions greatly appreciated.

Kevin

- --
Kevin Nikiforuk knikifor(at)gpu(dot)srv(dot)ualberta(dot)ca
- ----------------------------------------------------------------------------
http://pgp5.ai.mit.edu/pks-commands-beta.html for my PGP public key

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
Comment: Processed by mkpgp2.1, a Pine/PGP interface.

iQCVAwUBNWMqUMsSwbLUdSRVAQHRoQP/U+JxivVNCxS3t4vPAtZyLTkS7TTceh1v
e3da72tXLmNIODfWcuo8f19p4yoIeOUjOSu13HlKgO0s5lX94dbDe6aB4fly/tGu
ufVB2jdlm8KUT6LInfnx84eQj9BdT82NfWC9waS5I/Q9b+YybLyzwL65tWI8L/8z
BmkG9Byrtoc=
=mv4I
-----END PGP SIGNATURE-----

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin W. Nikiforuk 1998-05-20 21:37:57 Re: [GENERAL] java.lang.NullPointerException
Previous Message Peter Mount 1998-05-20 18:37:42 Re: [GENERAL] About Deleting Large Objects