DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28219>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28219 Dolar sign in password of JNDI-Datasource disappears Summary: Dolar sign in password of JNDI-Datasource disappears Product: Tomcat 5 Version: 5.0.19 Platform: PC OS/Version: Windows XP Status: NEW Severity: Minor Priority: Other Component: Catalina AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] In my server.xml I defined a JNDI datasource as described in the Tomcat docs, but I couldn't connect to the database and I always got the exception "Cannot create PoolableConnectionFactory". After a few hours of investigation I found out that the Database Connection Pool (DBCP) didn't get the right password, because the dolar sign of the password disappeared. So the password a$a$a of the configuration file server.xml changed to aaa in the DataSource. Below the configuration of server.xml (it requires the mysql connector package): <Resource name="jdbc/foo" scope="Shareable" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/foo"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <!-- DBCP database connection settings --> <parameter> <name>url</name> <value>jdbc:mysql://localhost/bar?autoReconnect=true</value> </parameter> <parameter> <name>driverClassName</name> <value>org.gjt.mm.mysql.Driver</value> </parameter> <parameter> <name>username</name> <value>root</value> </parameter> <parameter> <name>password</name> <value>a$a$a</value> </parameter> <!-- and a few other parameters as described in the JNDI Datasource howto --> </ResourceParams> And the jsp file to test it: <%@ page import="javax.naming.*" %> <%@ page import="javax.sql.*" %> <%@ page import="java.sql.*" %> <%@ page import="org.apache.commons.dbcp.*" %> <% try { Context ctx = new InitialContext(); if (ctx == null ) throw new Exception("Boom - No Context"); DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/foo"); if (ds != null) { BasicDataSource bds = (BasicDataSource)ds; out.println(bds.getUsername()); out.println(bds.getPassword()); // gives aaa instead of a$a$a out.println(bds.getUrl()); out.println(bds.getDriverClassName()); } else { out.print("No DataSource"); } } catch (SQLNestedException ee) { StackTraceElement b[] = ee.getStackTrace(); out.print(ee.getMessage() + " in method " + b[0].getMethodName() + " in file " + b[0].getFileName() + " line " + String.valueOf(b[0].getLineNumber())); } catch(Exception e) { out.print(e.getMessage()); } %> I did a short test if this behavoir occurs also with other parameters (ex username) and the same error appeared, so maybe the whole deployment descriptor is affected --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]