Re: Suggestion for an improvement... ("database" part missing

From: Barry Lind <barry(at)xythos(dot)com>
To: "'Thomas Haeberlen'" <Haeberlen(at)RUS(dot)Uni-Stuttgart(dot)DE>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Suggestion for an improvement... ("database" part missing
Date: 2002-03-25 22:16:23
Message-ID: 3C9FA1B7.6050106@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

This should now be fixed in current sources.

thanks,
--Barry

Dave Cramer wrote:
> Yes, you are correct, it shouldn't NPE when you don't put the database
> in
>
> Dave
>
>
>>-----Original Message-----
>>From: pgsql-jdbc-owner(at)postgresql(dot)org
>>[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Thomas Haeberlen
>>Sent: Tuesday, March 19, 2002 1:43 PM
>>To: pgsql-jdbc(at)postgresql(dot)org
>>Subject: [JDBC] Suggestion for an improvement... ("database"
>>part missing in URI)
>>
>>
>>Hello list, especially hello developers,
>>
>>I am new to PostgreSQL and I tried the Postgresql jdbc driver for the
>>first time today, so please bear with me if the following
>>sounds silly:
>>
>>I have a suggestion for a small but probably helpful
>>improvement for the next release:
>>
>>When I omit the "database" part in the database URI used in
>>
>>DriverManager.getConnection("jdbc:postgresql://hostname/databa
>>se", ... )
>>
>>the error message is not very helpful:
>>
>>----------------------------- snip
>>-------------------------------------
>>Something unusual has occured to cause the driver to fail.
>>Please report this exception: Exception:
>>java.lang.NullPointerException Stack Trace:
>>
>>java.lang.NullPointerException
>> at
>>org.postgresql.Connection.openConnection(Connection.java:155)
>> at org.postgresql.Driver.connect(Driver.java:149)
>> at
>>java.sql.DriverManager.getConnection(DriverManager.java:517)
>> at
>>java.sql.DriverManager.getConnection(DriverManager.java:177)
>> at testpgsql.main(testpgsql.java:13)
>>End of Stack Trace
>>
>>--------------------------------------------------------------
>>----------
>>
>>and on the postmaster's stderr you get
>>
>>DEBUG: pq_recvbuf: unexpected EOF on client connection
>>DEBUG: incomplete startup packet
>>
>>This had me searching for some obscure error in my setup
>>(networking, db access permissions, and all that) for several
>>hours until I finally
>>discovered that all that was missing was indeed the database name...
>>
>>Couldn't this error be caught right at the beginning when the
>>URI is read?
>>
>>I guess this might be a quite common error and I'd say it
>>would be a lot more "user-friendly" (well, ok, programmer
>>friendly) if there could be an
>>exception with a more meaningful message like for example
>>"database name
>>missing in URI" or at least "invalid URI" instead of a
>>SQLException triggered
>>by a NullPointerException...
>>
>>Anyhow, I hope this message might at least be useful for
>>others and save them some time when they make the same mistake :-)
>>
>>Cheers
>>
>>Thomas
>>
>>
>>--
>>Thomas Haeberlen
>>Rechenzentrum Universitaet Stuttgart (RUS)
>>Abteilung Informationsdienste
>>Allmandring 30 , D-70569 Stuttgart
>>Email: haeberlen(at)rus(dot)uni-stuttgart(dot)de
>>Phone: +49 711 685 47 19 Fax: +49 711 678 76 26
>>
>>---------------------------(end of
>>broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-03-25 22:34:06 Re: BigDecimal Bugs
Previous Message mailing-list 2002-03-25 20:44:08 Re: BigDecimal Bugs