I am writing a Java JDBC database application that connects to an Oracle 11g database and am using a c3p0 connection pool. For the purposes of an example, I have 3 database users DEFAULT, TOM, and BILL. c3p0 opens all of the pooled Connections with the DEFAULT database user. I would like to retrieve one of the pooled Connections from c3p0 and change the user for the Connection to be BILL instead of DEFAULT. Is it possible to do this in JDBC without establishing a new connection with the database?
I have already tried doing the following:
connect BILL/password;
But this does not work. I get an error saying
java.sql.SQLException: ORA-00900: invalid SQL statement
Are there any other options? Is there something having to do with context set or switching that can facilitate what I'm trying to do?
Thanks!