From: | ebeard(at)lexmark(dot)com |
---|---|
To: | barry(at)xythos(dot)com |
Cc: | nickf(at)ontko(dot)com, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2002-06-07 14:12:45 |
Message-ID: | 200206071413.KAA05388@interlock2.lexmark.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Thanks for the fast response. Yes I am using the 1.4 JDK. Once I supplied a
database name, things worked fine. I don't have the 1.3 JDK installed anymore,
so it will be a few days before I can reinstall it and try it to see what
happens.
Eric
Barry Lind <barry%xythos(dot)com(at)interlock(dot)lexmark(dot)com> on 06/05/2002 03:23:07 PM
To: Eric_Beard(dot)LEXMARK(at)sweeper(dot)lex(dot)lexmark(dot)com
cc: nickf%ontko(dot)com(at)interlock(dot)lexmark(dot)com,
pgsql-jdbc%postgresql(dot)org(at)interlock(dot)lexmark(dot)com (bcc: Eric
Beard/Lex/Lexmark)
Subject: Re: [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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jon Swinth | 2002-06-07 16:43:06 | Re: "No Results were returned by the query" exception |
Previous Message | Shmuel A. Kahn | 2002-06-07 09:05:08 | Re: Newbie question - Applet works only in appletviewer |