Subject Nullpointer Exception when connecting with Beta2
Author Thomas Kellerer
Hello,

I have a SQL Tool that connects to a Firebird Database. The 1.5.5
Driver does not work propery with Firebird2 Alpha 3 (problems with
DatabaseMetadat), so I tried to use Jaybird 2.0 Beta2.

But unfortunately when connecting, the Firebird driver throws a
NullPointerException.

My tool uses a separate classloader to load the JDBC driver and
establish the connection, and it seems that this is the problem with
JayBird Beta 2 (the same code works fine with Firebird 1.5 and Jaybird
1.5)

The following code can be used to reproduce the NPE:

URL[] url = new URL[1];
url[0] = new File("jaybird-full-2.0.0.jar").toURL();
ClassLoader classLoader = new URLClassLoader(url);
Class drvClass = classLoader.loadClass("org.firebirdsql.jdbc.FBDriver");
Driver drv = (Driver)drvClass.newInstance();
Properties props = new Properties();
props.put("user", "thomas");
props.put("password", "welcome");
Connection con =
drv.connect("jdbc:firebirdsql://localhost:3051/thk",props);

Of course I supplied the full path to the .jar file and I am using the
correct version for my JDK (actually I tried with JDK 1.5 and JDK 1.4)

The database is up and running. With Jaybird 1.5.5 I can connect using
the above JDBC url (same code).

Btw: the reason I tried Jaybird 2.0 is that I get an error when
calling DatabaseMetaData.getColumns() with Jaybird 1.5.5 and
Firebird2

The error is:

GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 291
CHARACTER_LENGTH [SQL State=HY000, DB Errorcode=335544569]

GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 291
CHARACTER_LENGTH [SQL State=HY000, DB Errorcode=335544569]

org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
SQL Error
SQL error code = -104
Token unknown - line 1, char 291
CHARACTER_LENGTH
at
org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:88)
at
org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:34)
at
org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:701)
at
org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:232)
at
org.firebirdsql.jdbc.AbstractConnection.getStatement(AbstractConnection.java:1046)
at
org.firebirdsql.jdbc.AbstractConnection.doQuery(AbstractConnection.java:1078)
at
org.firebirdsql.jdbc.FBDatabaseMetaData.getColumns(FBDatabaseMetaData.java:2516)



Regards
Thomas