DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6721>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6721 JDBCRealm with certain JDBC drivers does not work Summary: JDBCRealm with certain JDBC drivers does not work Product: Tomcat 4 Version: 4.0.2 Final Platform: PC OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I tried to create a JDBCRealm connecting to Firebird 1.0 using Interclient-JDBC drivers. My configuration of server.xml/web.xml is nearly the same as described in the Tomcat examples. The configuration worked fine with mySQL. When using Firebird, I got the following exception, when I entered the JDBCRealm: java.lang.NullPointerException at interbase.interclient.PreparedStatement.setString(PreparedStatement.java:979) at org.apache.catalina.realm.JDBCRealm.credentials(JDBCRealm.java:484) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:376) at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:326) I found out that on the first time you enter a ressource in the JDBCRealm, the method credential sets the username to null: preparedCredentials.setString(1, username); Some JDBC drivers want to have a correct set String. The following patch of the method authenticate(Connection dbConnection, String username, String credentials) did the job: [snip] // Look up the user's credentials String dbCredentials = null; PreparedStatement stmt = null; ResultSet rs = null; try { stmt = credentials(dbConnection, username); rs = stmt.executeQuery(); while (rs.next()) { dbCredentials = rs.getString(1).trim(); } rs.close(); } catch (Exception ex) { // some JDBC drivers are throwing a null pointer exception // if the prepared statement parameter is set to null } if (dbCredentials == null) { return (null); } [snip] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
