[odb-users] oracle connection pool cause too many INACTIVE session

杨江骅 spiritonly at gmail.com
Tue Jan 15 19:49:42 EST 2013


Kolpackov:
     Thank you for answering. I'm careless about the order of the
parameters. I think the problem is solved.



On Tue, Jan 15, 2013 at 8:48 PM, Boris Kolpackov <boris at codesynthesis.com>wrote:

> Hi,
>
> spiritonly at gmail.com writes:
>
> > I use following code to get database instance for singleton, but when
> > i close my exe, there are many INACTIVE sessions in oracle.
> >
> > [...]
> >
> > static odb::database* get(const std::string& user, const std::string&
> >                           password, const std::string& dbName)
> > {
> >   auto_ptr<odb::oracle::connection_factory> connection_pool(new
> >     odb::oracle::connection_pool_factory (1, 10));
> >   static odb::oracle::database _database(user, password, dbName, 0, 0, 0,
> >                                          connection_pool);
> >   return &_database;
> > }
>
> The arguments you pass to the connection_pool_factory constructor are
> invalid. max_connections (the first argument) should be greater or equal
> to min_connections (the second argument).
>
> Once this is fixed, the pooled connections will be automatically closed
> when the database instance is destroyed, which in your case will happen
> automatically if the application terminates normally (i.e., by returning
> from main() or by calling exit()).
>
> Boris
>


More information about the odb-users mailing list