You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mech <me...@rz.fh-augsburg.de> on 2003/01/14 14:23:11 UTC

RE: JDBCRealm problem with MySQL after adding password and changing user account (bug, unclear tomcat documentation or my stupidity?)

Sorry, for the post... Solved it myself.
The trick was that you should NOT put your password into the
"connectionURL"

instead one can use:

<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
      		driverName="com.mysql.jdbc.Driver"
   		connectionURL="jdbc:mysql://localhost:3307/praksis"
   		connectionName="praksis"
   		connectionPassword="siskarp"
       		userTable="benutzer" userNameCol="email"
userCredCol="passwort"
   		userRoleTable="rollen" roleNameCol="rollenname"
digest="SHA-1"/>

Although I have no idea why the tomcat documentation offers an example
for exactly the case where you put username and password into the
"connectionURL". 
For some reason it works unless you only specify a user in the URL, but
for more one has to split the data into "connectionURL",
"connectionName" and "connectionPassword"

Did anybody have similar experiences? Is this a bug while parsing the
server.xml?
At least it doesn't seem to be very consistent, if connectionURL works
with "jdbc:mysql://localhost:3307/praksis?user=root" but not with
"jdbc:mysql://localhost:3307/praksis?user=root&password=test"

So I start using ONLY "connectionName" and "connectionPassword" as I
might get gray hairs soon enough anyway... ;-)

Michael


> -----Original Message-----
> From: mech [mailto:mech@RZ.FH-Augsburg.DE] 
> Sent: Dienstag, 14. Januar 2003 14:06
> To: tomcat-user@jakarta.apache.org
> Subject: JDBCRealm problem with MySQL after adding password 
> and changing user account
> 
> 
> Hi,
> 
> I have a problem with my Tomcat 4.1.18 JDBCRealm setup on 
> Solaris in server.xml
> 
> Previously I had this in my context definition in server.xml 
> and it works fine:
> 
>       <Realm className="org.apache.catalina.realm.JDBCRealm" 
> debug="99"
>       		driverName="com.mysql.jdbc.Driver"
>  
> connectionURL="jdbc:mysql://localhost:3307/praksis?user=root"
>        		userTable="benutzer" 
> userNameCol="email" userCredCol="passwort"
>    		userRoleTable="rollen" roleNameCol="rollenname" 
> digest="SHA-1"/>
> 
> Then I added a new user in MySQL named "praksis" to replace 
> the root access and tried to change to this setup:
> 
>       <Realm className="org.apache.catalina.realm.JDBCRealm" 
> debug="99"
>       		driverName="com.mysql.jdbc.Driver"
>  
> connectionURL="jdbc:mysql://localhost:3307/praksis?user=praksi
> s&password
> =siskarp"
>        		userTable="benutzer" 
> userNameCol="email" userCredCol="passwort"
>    		userRoleTable="rollen" roleNameCol="rollenname" 
> digest="SHA-1"/>
> 
> Now I only get weird error messages from the xml parser:
> 	org.xml.sax.SAXParseException: The reference to entity 
> "password" must end with the ';' delimiter.
> 
> Thus I tried 
> "jdbc:mysql://localhost:3307/praksis?user=praksis&password=sis
> karp;" but this didn't do the trick... Does it mean anything 
> else? I use "mysql-connector-java-2.0.14.jar" in common/lib 
> (for tomcat) and webapps/praksis/WEB-INF/libs (for struts)
> 
> But I believe the connectionURL is correct because I looked 
> it up in the tomcat doc under jdbc realms. 
> The MySQL setup/user setup should be okay aswell, because my 
> Struts connection pool works with:
> 
> 	<data-sources>
> 		<data-source>
> 			<set-property property="driverClass" 
> value="com.mysql.jdbc.Driver"/>
> 			<set-property property="url" 
> value="jdbc:mysql://localhost:3307/praksis"/>
> 			<set-property property="maxCount" value="25"/>
> 			<set-property property="minCount" value="5"/>
> 			<set-property property="user" value="praksis"/>
> 			<set-property property="password"
> value="siskarp"/>
> 		</data-source>		
> 	</data-sources>
> 
> So right now, I'm using a root access without password for my 
> JDBC Realm, because the different JDBC Realm prohibits Tomcat 
> from starting up. But my webapp itself can utilize the struts 
> connection pool with above user account setup without any problems.
> 
> Actually I don't know what I did wrong and was hoping for 
> help that I can use the "praksis" user for both purposes.
> 
> Thanks!
> Michael
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>