Search code examples
java-8connectionconnection-poolingc3p0

C3P0 rawStatementOperation usage


I am using C3P0 connection pooling in my project.

I came across below Method in C3P0ProxyStatement,

C3P0ProxyStatement pStmt = (C3P0ProxyStatement) stmt;
pStmt.rawStatementOperation(..,..);

Please help me with below doubts ,

What is the use of rawStatementOperation in this c3p0 ?

Why does this statement takes reflect API method as parameter?

Using it will it impact performance?


Solution

  • People rarely use this API recently, preferring the JDBC4 standard unwrap(...) to get access to native Statements and Connections.

    Yes, this c3p0-specific API is reflective (and it is a bit safer than unwrapping, as c3p0 will track and try to clean up some JDBC resources that might be returned). The cost of a reflective method call is high relative to an ordinary method call, but negligible relative to the cost of database operations. It won't meaningfully impact performance.