You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/01/21 21:25:13 UTC

DO NOT REPLY [Bug 41428] New: - org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory URL Parsing Bug

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=41428>.
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=41428

           Summary: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory URL
                    Parsing Bug
           Product: Tomcat 5
           Version: 5.5.20
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina:Modules
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: hander3@terra.com


Hello,

I think there's a bug at the 
org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory at the time of parsing a 
certain MySQL url. When the connection url contains the "sessionVariables" 
property alone, everything works ok. However, when other properties are 
specified in addition to "sessionVariables", then an Exception is thrown when 
trying to establish a new connection. If the same url is specified using a 
Connection object inside my code, then NO error is thrown. It only happens 
when that same url is set at the Resource config of the server.xml file. I 
include some examples to reproduce the error:

Everything goes fine when this is the config of the resource (note that the 
important part is the url):

<Resource name="jdbc/starnum" auth="Container" type="javax.sql.DataSource"
     factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
     maxActive="15"
     maxIdle="5"
     validationQuery="SELECT 1"
     testOnBorrow="false"
     testWhileIdle="true"
     timeBetweenEvictionRunsMillis="10000"
     minEvictableIdleTimeMillis="60000"
     username="user"
     password="pass"
     driverClassName="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost:3316/db?
sessionVariables=@date='0',@version='1.0';"
/>

However, if we set this other url, an error will be printed on the tomcat's 
log file:

jdbc:mysql://localhost:3316/db?
transformedBitIsBoolean=true&sessionVariables=@da
te='0',@version='1.0';

It seems to be a bug when sessionVariables is specified in addition to other
properties, like transformedBitIsBoolean in the previous example.

As I mentioned above, when this same url is set using a Connection object 
inside my application, no Exception is thrown, so I think the bug is located 
at the BasicDataSourceFactory class.

Thank you!

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41428] - org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory URL Parsing Bug

Posted by bu...@apache.org.
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=41428>.
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=41428





------- Additional Comments From rh3_sp@yahoo.es  2007-01-23 12:55 -------
you need to encode the amersand in your XML configuration, otherwise the XML 
parser thinks sessionVariables is an encoded entity. Change the "&" to "&amp;":

jdbc:mysql://localhost:3316/db?
transformedBitIsBoolean=true&amp;sessionVariables=@date='0',@version='1.0';

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41428] - org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory URL Parsing Bug

Posted by bu...@apache.org.
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=41428>.
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=41428


rh3_sp@yahoo.es changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 41428] - org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory URL Parsing Bug

Posted by bu...@apache.org.
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=41428>.
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=41428





------- Additional Comments From hander3@terra.com  2007-01-23 05:38 -------
I forgot to include the exception thrown. Here it is:

org.xml.sax.SAXParseException: The reference to entity "sessionVariables" must 
end with the ';' delimiter.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException
(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown 
Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
	at org.apache.xerces.impl.XMLScanner.scanAttributeValue(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttribute
(Unknown Source)
	at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown 
Source)
	at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher
.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
	at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:489)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:543)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)


However, when the connection is established via a Connection object everything 
goes well. In this case, this is the code:

Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection=DriverManager.getConnection
("jdbc:mysql://localhost:3316/db?
transformedBitIsBoolean=true&sessionVariables=@date='0',@version='1.0';");

As you can see, the URL is the same in both cases. However, now that I've 
looked at the Exception in detail, the bug seems to be at the 
org.apache.tomcat.util.digester.Digester.parse method and not in the DBCP.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org