You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Ricotta (JIRA)" <ji...@apache.org> on 2007/01/21 21:30:29 UTC
[jira] Created: (DBCP-208) URL Parsing Bug
URL Parsing Bug
---------------
Key: DBCP-208
URL: https://issues.apache.org/jira/browse/DBCP-208
Project: Commons Dbcp
Issue Type: Bug
Environment: Tomcat DBCP
Reporter: Ricotta
Priority: Minor
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=@date='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!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (DBCP-208) URL Parsing Bug
Posted by "R (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466820 ]
R commented on DBCP-208:
------------------------
Niall & Phil,
Absolutely, that was the problem! Thank you very much and sorry for the time lost in this issue.
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: R
> Priority: Minor
> Fix For: 1.3
>
>
> 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/db" 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 in the previous example, an error will be printed on the tomcat's log file:
> jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='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.
> This is the exception thrown:
> 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)
> This is the code I've used to test the same URL, but establishing a new Connection object inside my application:
> 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'm looking 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. Sorry if that's the case.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Resolved: (DBCP-208) URL Parsing Bug
Posted by "R (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
R resolved DBCP-208.
--------------------
Resolution: Invalid
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: R
> Priority: Minor
> Fix For: 1.3
>
>
> 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/db" 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 in the previous example, an error will be printed on the tomcat's log file:
> jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='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.
> This is the exception thrown:
> 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)
> This is the code I've used to test the same URL, but establishing a new Connection object inside my application:
> 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'm looking 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. Sorry if that's the case.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Updated: (DBCP-208) URL Parsing Bug
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz updated DBCP-208:
-----------------------------
Fix Version/s: 1.3
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: Ricotta
> Priority: Minor
> Fix For: 1.3
>
>
> 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=@date='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!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (DBCP-208) URL Parsing Bug
Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466739 ]
Niall Pemberton commented on DBCP-208:
--------------------------------------
So it looks like you need to encode the amersand in your XML configuration, otherwise the XML parser thinks sessionVariables is an encoded entity - try changing the "&" to "&"
jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='0',@version='1.0';
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: Ricotta
> Priority: Minor
> Fix For: 1.3
>
>
> 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/db" 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 in the previous example, an error will be printed on the tomcat's log file:
> jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='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.
> This is the exception thrown:
> 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)
> This is the code I've used to test the same URL, but establishing a new Connection object inside my application:
> 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'm looking 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. Sorry if that's the case.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Updated: (DBCP-208) URL Parsing Bug
Posted by "Ricotta (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ricotta updated DBCP-208:
-------------------------
Description:
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/db" 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 in the previous example, an error will be printed on the tomcat's log file:
jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='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.
This is the exception thrown:
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)
This is the code I've used to test the same URL, but establishing a new Connection object inside my application:
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'm looking 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. Sorry if that's the case.
was:
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=@date='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!
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: Ricotta
> Priority: Minor
> Fix For: 1.3
>
>
> 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/db" 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 in the previous example, an error will be printed on the tomcat's log file:
> jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='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.
> This is the exception thrown:
> 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)
> This is the code I've used to test the same URL, but establishing a new Connection object inside my application:
> 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'm looking 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. Sorry if that's the case.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (DBCP-208) URL Parsing Bug
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466360 ]
Phil Steitz commented on DBCP-208:
----------------------------------
DBCP should just pass the URL unchanged to the driver's connect() method. Can you post or more fully describe the code in your application that works? Also, the relevant bits of a stack trace showing where the exception is thrown would help.
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: Ricotta
> Priority: Minor
>
> 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=@date='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!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[jira] Commented: (DBCP-208) URL Parsing Bug
Posted by "Ricotta (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466735 ]
Ricotta commented on DBCP-208:
------------------------------
Hi Phil,
I've modified the original issue to include the Exceptions and the code I've used inside my application to test if the URL was valid.
Thank you!
> URL Parsing Bug
> ---------------
>
> Key: DBCP-208
> URL: https://issues.apache.org/jira/browse/DBCP-208
> Project: Commons Dbcp
> Issue Type: Bug
> Environment: Tomcat DBCP
> Reporter: Ricotta
> Priority: Minor
> Fix For: 1.3
>
>
> 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/db" 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 in the previous example, an error will be printed on the tomcat's log file:
> jdbc:mysql://localhost:3316/db?transformedBitIsBoolean=true&sessionVariables=@date='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.
> This is the exception thrown:
> 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)
> This is the code I've used to test the same URL, but establishing a new Connection object inside my application:
> 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'm looking 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. Sorry if that's the case.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org