You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/05/10 00:54:23 UTC
DO NOT REPLY [Bug 39537] New: - BasicDataSource.getConnection() Connections don't work as hashtable keys -- test case provided
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=39537>.
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=39537
Summary: BasicDataSource.getConnection() Connections don't work
as hashtable keys -- test case provided
Product: Commons
Version: Nightly Builds
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Dbcp
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: vegandy@gmail.com
Code I'm working with uses a Connection as a key in a Hashtable, and while I was
trying to move from DbConnectionBroker to DBCP, I ran into some problems.
When retrieving the value from the Hashtable using the Connection originally
returned by BasicDataSource.getConnection(), I don't get the value back that was
inserted into the Hashtable. I get null instead.
I've provided a patch to BasicDataSourceExample.java that can be used as a very
basic test case. For the purposes of the test, I set up HSQLDB (originally this
was discovered using JSQLConnect to connect to a MS SQL Server DB), and, using
the HSQLDB's DatabaseManager, populated a database with the test data (Options
-> Insert test data).
The patch to BasicDataSourceExample.java the will get a connection, use it to
insert a string into a Hashtable, then do some tests that show the problem,
while still succssfully retrieving data from the database.
Also in the patch are changes so you can provide all the arguments at the
command line.
I tested this with DBCP 1.2.1 with it's dependencies and with the nightly dump
http://cvs.apache.org/builds/jakarta-commons/nightly/commons-dbcp/commons-dbcp-20060509.tar.gz,
with the latest releases of commons-collections and commons-pool. For both tests
the j2ee.jar was version 1.4 and hsqldb.jar was version 1.8.0.2.
Here's the output from the session with the latest nightly build:
805: www@animal $-> javac -cp
/home/www/hsqldb/j2ee.jar:/www/classes/commons-collections-3.1.jar:/www/classes/commons-pool-1.3.jar:/home/www/hsqldb/dbcp/commons-dbcp/commons-dbcp.jar:/usr/share/java/hsqldb-1.8.0.2.jar
BasicDataSourceExample.java
806: www@animal $-> java -cp
/home/www/hsqldb/j2ee.jar:/www/classes/commons-collections-3.1.jar:/www/classes/commons-pool-1.3.jar:/home/www/hsqldb/dbcp/commons-dbcp/commons-dbcp.jar:/usr/share/java/hsqldb-1.8.0.2.jar:
BasicDataSourceExample "org.hsqldb.jdbcDriver"
"jdbc:hsqldb:file:/home/www/hsqldb/test" "sa" "" "SELECT FIRSTNAME, LASTNAME
FROM CUSTOMER"
Setting up data source.
Done.
Creating connection.
Hash contains key: jdbc:hsqldb:file:/home/www/hsqldb/test, UserName=SA, HSQL
Database Engine Driver ? false
Hash value for key: jdbc:hsqldb:file:/home/www/hsqldb/test, UserName=SA, HSQL
Database Engine Driver ? null
Hash contains value: test ? true
Creating statement.
Executing statement.
Results:
Laura Steel
Susanne King
Anne Miller
Michael Clancy
Sylvia Ringer
Laura Miller
Laura White
James Peterson
Andrew Miller
James Schneider
Anne Fuller
Julia White
George Ott
Laura Ringer
Bill Karsen
Bill Clancy
John Fuller
Laura Ott
Sylvia Fuller
Susanne Heiniger
Janet Schneider
Julia Clancy
Bill Ott
Julia Heiniger
James Sommer
Sylvia Steel
James Clancy
Bob Sommer
Susanne White
Andrew Smith
Bill Sommer
Bob Ringer
Michael Ott
Mary King
Julia May
George Karsen
John Steel
Michael Clancy
Andrew Heiniger
Mary Karsen
Susanne Miller
Bill King
Robert Ott
Susanne Smith
Sylvia Ott
Janet May
Andrew May
Janet Fuller
Robert White
George Fuller
807: www@animal $->
--
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39537] - [dbcp] BasicDataSource.getConnection() Connections don't work as hashtable keys -- test case provided
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=39537>.
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=39537
------- Additional Comments From bayard@apache.org 2006-09-08 22:48 -------
New url is: https://issues.apache.org/jira/browse/DBCP-128
--
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39537] - [dbcp] BasicDataSource.getConnection() Connections don't work as hashtable keys -- test case provided
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=39537>.
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=39537
------- Additional Comments From sandymac@apache.org 2006-05-10 16:38 -------
Skimming the source I think this may stem from DelegatingConnection having
equals() and hashCode() implementations that don't obey the equals & hashCode
contracts. My initial impressions is those methods should just be removed but
I'm not sure if this will have a negative side effects elsewhere.
--
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39537] - BasicDataSource.getConnection() Connections don't work as hashtable keys -- test case provided
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=39537>.
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=39537
------- Additional Comments From vegandy@gmail.com 2006-05-09 22:56 -------
Created an attachment (id=18252)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=18252&action=view)
patch to use BasicDataSourceExample as a simple test case
This is the patch I used to BasicDataSourceExample for provide a testcase for
this bug.
--
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 39537] - [dbcp] BasicDataSource.getConnection() Connections don't work as hashtable keys -- test case provided
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=39537>.
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=39537
gudnabrsam@yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|BasicDataSource.getConnectio|[dbcp]
|n() Connections don't work |BasicDataSource.getConnectio
|as hashtable keys -- test |n() Connections don't work
|case provided |as hashtable keys -- test
| |case provided
--
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org