I'm using Tomcat 3.2.2

I was just beginning to try out JDBCRealm and was continuing to get an
error.  The Tomcat.log said:

2001-06-26 11:27:05 - ContextManager: JDBCRealm: SQLException:
java.sql.SQLException: Login failed for user '(null)'. Reason: Not
associated with a trusted SQL Server connection. Severity 14, State 1,
Procedure 'null null', Line 0 Unable to connect, please check your server's
version and availability.

I WAS including the proper credentials in my web.xml, so I delved into the
Tomcat source code to find what was going wrong.  (this was my FIRST Tomcat
delving experience!)  In JDBCRealm, method checkConnection() I found this:

   if ((connectionName == null || connectionName.equals("")) ||
      (connectionPassword == null || connectionPassword.equals(""))) {
       dbConnection = DriverManager.getConnection(connectionURL);
    } else {
        dbConnection = DriverManager.getConnection(connectionURL,
        connectionName,
        connectionPassword);
    }

I'm practicing on an internal dev server that is poorly protected and has no
password for the username I was using, so my server.xml had:
    connectionName="aDevUser"   connectionPassword=""

Obviously, this is what is causing the problem, given the code snippet
above.

I created a new username with a real password, entered those in my
server.xml, and the problem went away.

Now I know it's not a good practice to have a password that is an empty
string, but is it an error?  Should this be logged as a Tomcat bug?  I'm
still fairly new to Tomcat and tried searching for this in Bugzilla and
didn't find anything and wasn't sure where to go from there.  Would someone
with more experience with the process like to enter this?

Reply via email to