Username and Passowrd configuration for a Tomcat Realm.
I'm using tomcat 4.0.4. I've configured it to work with my mySqld at localhost just like the way in the Realm How-To in the Jakarta Tomcat Documentation.
This still it doesnt work. Somehow the username turns to '@127.0.0.1'.
The realm configuration looks like this:<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driverName="org.gjt.mm.mysql.Driver" connectionURL="jdbc:mysql://localhost/jakarta?user=xxxxx;password=xxxxx" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name"/>The error looks like this:
java.sql.SQLException: General error: Access denied for user: '@127.0.0.1' to database 'jakarta'
It seems that the Realm isn't able to read the username from the jdbc url.
The solution could be found in the same document you were reading (Realm How-To), in the section JDBCRealm, that is to provide the username and the password as attributes of the Realm tag:
connectionName The database username used to establish a JDBC connection.
connectionPassword The database password used to establish a JDBC connection.