Re: - Mailing list pgsql-jdbc

From Barry Lind
Subject Re:
Date
Msg-id 3CFE651B.7060908@xythos.com
Whole thread Raw
In response to Re:  ("Nick Fankhauser" <nickf@ontko.com>)
List 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@ontko.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@postgresql.org so that your
> message can get through to the mailing list cleanly
>



pgsql-jdbc by date:

Previous
From: Bear Giles
Date:
Subject: Re: Java GUI development
Next
From: Vernon Wu
Date:
Subject: Re: Java GUI development