-
Bug
-
Resolution: Future Project
-
P5
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
C:\Programme\Java\jdk1.6.0\bin>java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP prof. SP-2
EXTRA RELEVANT SYSTEM CONFIGURATION :
using MS ACCESS
A DESCRIPTION OF THE PROBLEM :
In javadoc for interface PooledConnection you find the following:
----------------------------------------------------------------------------
An object that provides hooks for connection pool management. A PooledConnection
object represents a physical connection to a data source. ...
The connection pool manager, typically the application server, maintains a pool
of PooledConnection objects. If there is a PooledConnection object available in
the pool, the connection pool manager returns a Connection object that is a
handle to that physical connection. If no PooledConnection object is available,
the connection pool manager calls the ConnectionPoolDataSource method
getPoolConnection to create a new physical connection. The JDBC driver
implementing ConnectionPoolDataSource creates a new PooledConnection object and
returns a handle to it.
----------------------------------------------------------------------------
So class sun.jdbc.odbc.ee.ConnectionPoolDataSource should create a _new_
PooledConnection object containing a new physical connection to the data base by
method getPooledConnection(), which should be usable for _any_ connection pool
manager.
This is not performed in the current implementation of the JDBC-ODBC-Bridge.
Instead it checks out an _existent_ PooledConnection object out of the
internally implemented pool.
As class sun.jdbc.odbc.ee.ConnectionPoolDataSource also implements
javax.sql.DataSource it also serves as a pooled data source using internally
class ConnectionPool as connection pool manager. So method getConnection()
should check out an _existent_ Connection object by help of the internally
implemented connection pool manager, but not by passing to method
getPooledConnection() which should create a _new_ PooledConnection object.
The current implementation of class
sun.jdbc.odbc.ee.ConnectionPoolDataSource is:
{------------------------------------------------------------------------------------------
public PooledConnection getPooledConnection() throws SQLException{
return (PooledConnection) getPool().checkOut();
}
public PooledConnection getPooledConnection(String user, String
password) throws SQLException{
Properties p = super.getAttributes().getProperties();
p.put("user", user);
p.put("password",password);
return (PooledConnection) getPool().checkOut(p);
}
public Connection getConnection() throws SQLException {
return getPooledConnection().getConnection();
}
public Connection getConnection(String user, String password) throws
SQLException {
return getPooledConnection(user,password).getConnection();
}
------------------------------------------------------------------------------------------}
To serve the specification the implementation of class
sun.jdbc.odbc.ee.ConnectionPoolDataSource should be something like this:
{------------------------------------------------------------------------------------------
public PooledConnection getPooledConnection() {
return new PooledConnection(this, getConnectProperties());
}
public PooledConnection getPooledConnection(String user, String
password) {
return new PooledConnection(this, getConnectProperties(user,
password));
}
public Connection getConnection() throws SQLException {
return obtainPool().checkOut().getConnection();
}
public Connection getConnection(String username, String password)
throws SQLException {
return obtainPool().checkOut(username, password).getConnection();
}
------------------------------------------------------------------------------------------}
I have realised a correct implementation on
https://jdbc-odbc-enhanced.dev.java.net/
REPRODUCIBILITY :
This bug can be reproduced always.
C:\Programme\Java\jdk1.6.0\bin>java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows XP prof. SP-2
EXTRA RELEVANT SYSTEM CONFIGURATION :
using MS ACCESS
A DESCRIPTION OF THE PROBLEM :
In javadoc for interface PooledConnection you find the following:
----------------------------------------------------------------------------
An object that provides hooks for connection pool management. A PooledConnection
object represents a physical connection to a data source. ...
The connection pool manager, typically the application server, maintains a pool
of PooledConnection objects. If there is a PooledConnection object available in
the pool, the connection pool manager returns a Connection object that is a
handle to that physical connection. If no PooledConnection object is available,
the connection pool manager calls the ConnectionPoolDataSource method
getPoolConnection to create a new physical connection. The JDBC driver
implementing ConnectionPoolDataSource creates a new PooledConnection object and
returns a handle to it.
----------------------------------------------------------------------------
So class sun.jdbc.odbc.ee.ConnectionPoolDataSource should create a _new_
PooledConnection object containing a new physical connection to the data base by
method getPooledConnection(), which should be usable for _any_ connection pool
manager.
This is not performed in the current implementation of the JDBC-ODBC-Bridge.
Instead it checks out an _existent_ PooledConnection object out of the
internally implemented pool.
As class sun.jdbc.odbc.ee.ConnectionPoolDataSource also implements
javax.sql.DataSource it also serves as a pooled data source using internally
class ConnectionPool as connection pool manager. So method getConnection()
should check out an _existent_ Connection object by help of the internally
implemented connection pool manager, but not by passing to method
getPooledConnection() which should create a _new_ PooledConnection object.
The current implementation of class
sun.jdbc.odbc.ee.ConnectionPoolDataSource is:
{------------------------------------------------------------------------------------------
public PooledConnection getPooledConnection() throws SQLException{
return (PooledConnection) getPool().checkOut();
}
public PooledConnection getPooledConnection(String user, String
password) throws SQLException{
Properties p = super.getAttributes().getProperties();
p.put("user", user);
p.put("password",password);
return (PooledConnection) getPool().checkOut(p);
}
public Connection getConnection() throws SQLException {
return getPooledConnection().getConnection();
}
public Connection getConnection(String user, String password) throws
SQLException {
return getPooledConnection(user,password).getConnection();
}
------------------------------------------------------------------------------------------}
To serve the specification the implementation of class
sun.jdbc.odbc.ee.ConnectionPoolDataSource should be something like this:
{------------------------------------------------------------------------------------------
public PooledConnection getPooledConnection() {
return new PooledConnection(this, getConnectProperties());
}
public PooledConnection getPooledConnection(String user, String
password) {
return new PooledConnection(this, getConnectProperties(user,
password));
}
public Connection getConnection() throws SQLException {
return obtainPool().checkOut().getConnection();
}
public Connection getConnection(String username, String password)
throws SQLException {
return obtainPool().checkOut(username, password).getConnection();
}
------------------------------------------------------------------------------------------}
I have realised a correct implementation on
https://jdbc-odbc-enhanced.dev.java.net/
REPRODUCIBILITY :
This bug can be reproduced always.