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 2022/03/04 18:54:25 UTC

[Bug 65932] New: PreparedStatement 'getConnection' returns physical connection instead of pooled one

https://bz.apache.org/bugzilla/show_bug.cgi?id=65932

            Bug ID: 65932
           Summary: PreparedStatement 'getConnection' returns physical
                    connection instead of pooled one
           Product: Tomcat Modules
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: jdbc-pool
          Assignee: dev@tomcat.apache.org
          Reporter: okutishchev@apple.com
  Target Milestone: ---

[NOT A CONTRIBUTION]


JDBC Pool Version: 9.0.49
Database: Oracle
JDBC Version:  19.3.0.0
OS: Mac, Linux

prepareStatement created by ProxyConnection returns underlying physical
connection  not the PooledConnection.

Step to reproduce:
ConnectionPool pool = ...
Connection c = pool.getConnection();
PreparedStatement ps = c.createPreparedStatement();

assertTrue(c == ps.getConnection()) // return false

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65932] PreparedStatement 'getConnection' returns physical connection instead of pooled one

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65932

--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
It's probably a performance consideration NOT to wrap the connections returned
by Statement.getConnection().

Do you find different behavior if you use Tomcat's default database connection
pool (the one based upon commons DBCP2)?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65932] PreparedStatement 'getConnection' returns physical connection instead of pooled one

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65932

--- Comment #1 from Keiichi Fujino <kf...@apache.org> ---
Have you set
org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor?

This interceptor is available for prevents access to the actual connection.

see
https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65932] PreparedStatement 'getConnection' returns physical connection instead of pooled one

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65932

Alexey Kutishchev <ok...@apple.com> changed:

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

--- Comment #4 from Alexey Kutishchev <ok...@apple.com> ---
Closing this as a duplicated.

*** This bug has been marked as a duplicate of bug 48392 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65932] PreparedStatement 'getConnection' returns physical connection instead of pooled one

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65932

--- Comment #2 from Alexey Kutishchev <ok...@apple.com> ---
That helped.

I'm surprised to see that it is not a default behavior.

Any plans to change this?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org