Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: occi connection pooling not working as expected

Re: occi connection pooling not working as expected

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Thu, 03 Aug 2006 20:31:05 +0200
Message-ID: <eatkcf$jn6$1@news4.zwoll1.ov.home.nl>


vansluisdamster_at_gmail.com schreef:
> In a simple testprogram we face the issue that
> new connectionS are not taken from the allocated connection pool but
> newly created. We set min connection to 3 and see 3 initially but 4
> after connectionPool->createConnection
>
> This can be observed by counting and selectin in v$session. We changed
> also connection between dedicated
> and shared but no change in behaviour.
> I have seen this problem reported before but no solution.
> Also read an explanation about differences between connection and
> session pooling but no solution,
>
> It look more and more that there is a connectionPool but no method
> to get the connection from this pool.
> Is this true ? Is this not implemented in 9.2 ?
> In 10.2 docs we see this method. Does it work only in this release?
> Is it possible to use this occi, 10.2 against a 9.2.0.6 database ?
> Migration is not really an option right now.
>
> Any ideas are greatly appreciated.
>
> Details: Oracle 9.2.0.6 OCCI HPUX 11.11
>
> Tnx,
>
> Jeroen
>
> Testprogram used::
>
> RWBoolean DatabaseGlobal::dbInitLib(RWCString userName, RWCString
> password,
> RWCString database, long maxConnections,
> RWBoolean commitOn, char* module)
> {
>
> unsigned int minConn = 3;
> unsigned int incrConn = 2;
> if (!connPool) {
> try {
> connPool = env->createConnectionPool(userName.std(),
> password.std(),
> database.std(),
> minConn,
> maxConnections,
> incrConn);
> if (connPool) {
> Connection *con = connPool->createConnection(userName.std(),
> password.std());
> Statement *stmt = con->createStatement(
> "BEGIN dbms_application_info.set_module(:v1, :v2); END;");
> stmt->setAutoCommit(commitOn);
> stmt->setString(1, module);
> stmt->setString(2, 0);
> int updateCount = stmt->executeUpdate();
> con->terminateStatement(stmt);
> connPool->terminateConnection(con);
> return TRUE;
> }
> else {
> return FALSE;
> }
> }
> catch (SQLException e) {
> cout << e.getMessage() << endl;
> }
> }
> else {
> return FALSE;
> }
> return FALSE;
> }
>

AFAIK, connections are closed after you have, and some time. This time is to see whether a new pooled connection is opened, for which this (no longer used - you closed it) connection will be reused.
When no new connections are opened, the connection will be closed after a while (and no, I don not know how to influence that).
Also, pooled connections will open above the max number of connections when oracle sees fit to do so.

You were told this, today, weren't you?

-- 
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Received on Thu Aug 03 2006 - 13:31:05 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US