java.lang.NullPointerException
От | Kevin W. Nikiforuk |
---|---|
Тема | java.lang.NullPointerException |
Дата | |
Msg-id | Pine.LNX.3.95.980520125601.5353A-100000@sethanon обсуждение исходный текст |
Ответы |
Re: [GENERAL] java.lang.NullPointerException
|
Список | 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@gpu.srv.ualberta.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-----
В списке pgsql-general по дате отправления: