The driver told me to do it. - Mailing list pgsql-bugs

From erik.berglund@eyeone.no
Subject The driver told me to do it.
Date
Msg-id 3A9981D8.4943.665DCD6C@localhost
Whole thread Raw
List pgsql-bugs
Hi.
As per the instructions in the exception message, I report this bug.
However, this my first encounter with JDBC, so I'm pretty sure this
is because of some newbie mistake on my part. If indeed this is
the case, please feel free to enlighten me.

The postgresql jdbc driver gave me this error message:
<snip>
[erik@thunderdome server]$ ./start
JDBC driver loaded.
Failed database load:
Something unusual has occured to cause the driver to fail. Please
report this exception: java.lang.NullPointerException:
        at org.postgresql.Driver.connect(Driver.java:125)
        at
java.sql.DriverManager.getConnection(DriverManager.java:453)
        at
java.sql.DriverManager.getConnection(DriverManager.java:133)
        at eyeone.net.server.Server.<init>(Server.java:98)
        at eyeone.net.server.Server.main(Server.java:232)
EyeOne generic game server version 2.0.1 listening on port 3456
<snip>

So her is the report:
The postgresql data base is version 7.0.3
The jdbc driver is "jdbc7.0-1.2.jar" downloaded from
jdbc.postgresql.org.

The application in question is running on:
<snip>
java version "1.2.2"
Classic VM (build 1.2.2_006, green threads, nojit)
<snip>

Started with this command:
<snip>
java -cp .:./postgresql.jar -Djava.library.path=.
eyeone/net/server/Server 3456 $1
</snip>

And the code throwing the exception looks like this:
<snip>
//try to init the database
if((this.DBUSERNAME == null) || (this.DATABASE == null) ||
(this.DBPASSWORD==null))
{
    //skip database initing
}
else
{
    try
    {
        Class c = Class.forName("org.postgresql.Driver");
        System.err.println("JDBC driver loaded.");
        if(c == null)
        {
            System.err.println("Or is it?");
        }
        java.sql.Connection db =
DriverManager.getConnection("127.0.0.1", this.DBUSERNAME,
this.DBPASSWORD);
        if(db != null)
        {
            System.err.println("Connected to database.");
        }
        else
        {
            System.err.println("No connection available.");
        }
    }
    catch(Exception e)
    {
        System.err.println("Failed database load:");
        e.printStackTrace();
    }
}
</snip>
(If you wish, I'll gladly send You the entire .java file.)

Regards,
Erik Berglund
game programmer
www.eyeone.com

pgsql-bugs by date:

Previous
From: Stu Coates
Date:
Subject: Re: Lock Detection (was: pg_dump failing on LinuxPPC)
Next
From: Jaume Teixi
Date:
Subject: COPY doesn't works with es_ES characters