I forget to describe when the exception "java.sql.Exception: Cannot disable
AUTO_COMMIT" it's thrown: when I start tomcat with the command
"%CATALINA_HOME%\catalina run" in the stdout or when I start the "Apache
Tomcat" service in the %CATALIN_HOMEA%\logs\stdout.log.

I've used your columns name and I've added after the "CREATE TABLE" a
"TYPE=MYISAM"
command, for specifing a non-transactional type of table, as you suggest
(but I don't know
the difference, if you can explain, please)...

CREATE TABLE tomcat_users (
     user_name   VARCHAR(30) NOT NULL PRIMARY KEY,
     user_pass   VARCHAR(30) NOT NULL
) TYPE = MYISAM;

CREATE TABLE tomcat_roles (
     user_name   VARCHAR(30) NOT NULL,
     role_name   VARCHAR(30) NOT NULL,
     PRIMARY KEY (user_name, role_name)
) TYPE = MYISAM;


But nothing changes: again the same exception.
(I'm under a win2k box with Tomcat4 and MySQL 3.23.42-nt)

TIA, matteodg.it


>>--------------------------------------------------------------------------
-----

>>I have copied mysql.jar, containing org.gjt.mm.mysql.Driver, in
>>$CATALINA_HOME/common/lib as described in tomcat-docs.
>>
>>Then I have added in $CATALINA_HOME/conf/server.xml the Realm element as
>>shown below:
>>
>><Realm
>>     className="org.apache.catalina.realm.JDBCRealm"
>>     debug="99"
>>     driverName="org.gjt.mm.mysql.Driver"
>>     connectionURL="jdbc:mysql://localhost/database"
>>     connectionName="login"
>>     connectionPassword="password"
>>     userTable="users"
>>     userNameCol="username"
>>     userCredCol="password"
>>     userRoleTable="roles"
>>     roleNameCol="role"
>>/>
>>
>>In my logs I have this exception:
>>
>>LifecycleException:  Exception opening database connection:
>>java.sql.SQLException: Cannot disable AUTO_COMMIT
>
>I just tried this, albeit with somewhat different column names.
>Authentication worked, I did not get the error you see.  I thought
>perhaps your error might occur if the table was not one of the
transactional
>types, but I used MyISAM (non-transactional) and it will worked.
>
>For reference, here's my Realm element (modified to protect db name,
>user name, pwd):
>
><Realm
>     className="org.apache.catalina.realm.JDBCRealm"
>     debug="99"
>     driverName="org.gjt.mm.mysql.Driver"
>     connectionURL="jdbc:mysql://localhost/db_name"
>     connectionName="some_user"
>     connectionPassword="some_pass"
>     userTable="tomcat_users"
>     userNameCol="user_name"
>     userCredCol="user_pass"
>     userRoleTable="tomcat_roles"
>     roleNameCol="role_name"
>/>
>
>My tables look like this:
>
>CREATE TABLE tomcat_users
>(
>     user_name   VARCHAR(30) NOT NULL PRIMARY KEY,
>     user_pass   VARCHAR(30) NOT NULL
>);
>
>INSERT INTO tomcat_users (user_name, user_pass)
>     VALUES ('mgr_user', 'xxxxxxxx');
>
>SELECT * FROM tomcat_users;
>
>CREATE TABLE tomcat_roles
>(
>     user_name   VARCHAR(30) NOT NULL,
>     role_name   VARCHAR(30) NOT NULL,
>     PRIMARY KEY (user_name, role_name)
>);
>
>INSERT INTO tomcat_roles (user_name, role_name)
>     VALUES ('mgr_user', 'manager');
>
>Here are the queries I see in the MySQL log when I attempt to use the
>manager application:
>
>011017 17:01:55   72516 Query       SELECT user_pass FROM
>tomcat_users WHERE user_name = null
>011017 17:02:00   72516 Query       SELECT user_pass FROM
>tomcat_users WHERE user_name = 'mgr_user'
>    72516 Query       SELECT role_name FROM
>tomcat_roles WHERE user_name = 'mgr_user'
>    72516 Query       commit
>
>>     at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615)
>>     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.CatalinaService.start(CatalinaService.java:261
)
>>     at
>>org.apache.catalina.startup.CatalinaService.execute(CatalinaService.java:1
72
>>)
>>     at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>>     at java.lang.reflect.Method.invoke(Native Method)
>>     at
>>org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:36
0)
>>----- Root Cause -----
>>java.sql.SQLException: Cannot disable AUTO_COMMIT
>>     at org.gjt.mm.mysql.Connection.setAutoCommit(Connection.java:396)
>>     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.CatalinaService.start(CatalinaService.java:261
)
>>     at
>>org.apache.catalina.startup.CatalinaService.execute(CatalinaService.java:1
72
>>)
>>     at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>>     at java.lang.reflect.Method.invoke(Native Method)
>>     at
>>org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:36
0)
>>
>>It's my fault? Or perhaps a bug on MySQL or on Tomcat??
>>
>>Thanks in advance,
>>matteodg.it
>
>
>--
>Paul DuBois, [EMAIL PROTECTED]
>



Reply via email to