Thread

  1. The driver told me to do it.

    erik.berglund@eyeone.no — 2001-02-25T21:06:16Z

    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