I am having problems connecting to a Cloudscape (v3.6) db using Tomcat 4.0.1
when using JDBC realm in my server.xml

The error I get is:
java.lang.NullPointerException
        at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:549)
        at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:307)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:388)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:505)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:776)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)


This got me looking at the code in JDBCRealm.java.
The code (at the lines in question) is as follows:

542:        // Open a new connection
543:        Properties props = new Properties();
544:        if (connectionName != null)
545:            props.put("user", connectionName);
546:        if (connectionPassword != null)
547:            props.put("password", connectionPassword);
548:        dbConnection = driver.connect(connectionURL, props);
549:        dbConnection.setAutoCommit(false);
550:        return (dbConnection);

I wrote a test program connecting to Cloudscape (via the WebLogic 
driver) and found that:

dbConnection = driver.connect(connectionURL, props);

returns a NULL, whereas

dbConnection = DriverManager.getConnection(connectionURL, props);

returns the connection.

Now, as far as I can recollect, though the former is valid, it is not a 
recommended method
for getting a connection. Using DriverManager is the recommended method.

Any ideas why the "driver" itself is being used to get the connection. 
If there is a general  consensus can this
be replaced with DriverManager instead?

Cheers
-raj

Reply via email to