Re:

From: Barry Lind <barry(at)xythos(dot)com>
To: ebeard(at)lexmark(dot)com
Cc: nickf(at)ontko(dot)com, pgsql-jdbc(at)postgresql(dot)org
Subject: Re:
Date: 2002-06-05 19:23:07
Message-ID: 3CFE651B.7060908@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Eric,

I looked at this some more, are you running on a 1.4 JDK? I can
reproduce this error with a 1.4 JDK, however on a 1.3 JDK it works fine.
In looking at where the null pointer exception is being thrown it
really looks like a bug in the 1.4 JDK and not a problem with the jdbc code.

Can you try running your code under a 1.3 jdk and see what happens?

thanks,
--Barry

PS. In my reproducing of this problem the stack trace of the NPE is:
java.lang.NullPointerException
at java.io.PrintWriter.write(PrintWriter.java:247)
at java.io.PrintWriter.print(PrintWriter.java:392)
at java.io.PrintWriter.println(PrintWriter.java:529)
at java.lang.Throwable.printStackTrace(Throwable.java:509)
at java.sql.SQLException.<init>(SQLException.java:103)
at org.postgresql.util.PSQLException.<init>(PSQLException.java:39)
at org.postgresql.Connection.openConnection(Connection.java:304)
at org.postgresql.Driver.connect(Driver.java:153)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at test3.connect(test3.java:43)
at test3.run(test3.java:36)
at test3.main(test3.java:68)

Where Connection.java:304 is:
throw new
PSQLException("postgresql.con.backend",pg_stream.ReceiveString(encoding));

and PSQLException.java:39 is:
super();

The default no arg constructor on java.sql.SQLException is being called
by the call to super() and it is causing a NPE.

The problem shows up when and exception is being thrown, masking the
real problem. The workaround is to run under jdk1.3 to see the real
error until sun fixes this bug in the 1.4jdk.

Nick Fankhauser wrote:
> Eric-
>
>
>
>> System.out.println("Driver loaded");
>> Connection con = DriverManager.getConnection
>>
>>("jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432","db","pw");
>
>
>
> It looks like you haven't specified a database in the URL. I would expect to
> see a URL that looks more like this:
>
> jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432/database-name
> ^^^^^^^^^^^
>
> Regards,
>
> -Nick
>
> --------------------------------------------------------------------------
> Nick Fankhauser nickf(at)ontko(dot)com Phone 1.765.935.4283 Fax 1.765.962.9788
> Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

  • Re: at 2002-06-05 15:29:31 from Nick Fankhauser

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2002-06-05 19:32:50 Re: Java GUI development
Previous Message Bear Giles 2002-06-05 19:15:12 Re: Java GUI development