Connection pooling

54 views
Skip to first unread message

Allan

unread,
Jul 12, 2012, 12:19:41 AM7/12/12
to orbr...@googlegroups.com

Hi All,
I was wondering how does one setup connection pooling with OR BROKER? Is there a built-in functionality? If not, how can we integrate third party (e.g. c3po ) with OR BROKER configs?

Thank you.

Allan

Nils Kilden-Pedersen

unread,
Jul 12, 2012, 8:25:49 AM7/12/12
to orbr...@googlegroups.com
The BrokerConfig takes a javax.sql.DataSource, so just provide it with a pooling data source, which most drivers come with. And if not, then you can use something like c3p0.

Allan

unread,
Jul 12, 2012, 11:34:24 PM7/12/12
to orbr...@googlegroups.com

Hi Nils,
Thank you. I think that will work. If I get it to work, I will write back the steps to you, perhaps you can add it in your wiki.

Thanks,
Allan

Nils Kilden-Pedersen

unread,
Jul 13, 2012, 9:22:07 AM7/13/12
to orbr...@googlegroups.com
Allan,

Which JDBC driver are you using?

Nils

Allan

unread,
Jul 14, 2012, 12:44:14 AM7/14/12
to orbr...@googlegroups.com

Hi Nils,

I'm using Oracle. Maven-scala based project.

Thanks,
Allan


On Friday, July 13, 2012 6:22:07 AM UTC-7, Nils Kilden-Pedersen wrote:
Allan,

Which JDBC driver are you using?

Nils



Nicholas Ustinov

unread,
Jul 14, 2012, 4:50:37 AM7/14/12
to orbr...@googlegroups.com
Hi, Allan

If so, you can use oracle's implicit connection pool in thin driver (see OracleDataSource  and it's properties, especially  connection­Cache­Properties  and  connectionCachingEnabled) or you can use jdbc oci driver and it's oci connection pooling.
As i know if you want third-party alternatives then BoneCP or Tomcat JDBC connection pool (it can be used standalone) can be good replacement.

Nicholas

2012/7/14 Allan <d.one...@gmail.com>

Allan

unread,
Jul 14, 2012, 5:03:27 PM7/14/12
to orbr...@googlegroups.com

Hi Nicholas,

Thanks! OracleConnectionPoolDataSource (http://docs.oracle.com/cd/E14072_01/appdev.112/e13995/oracle/jdbc/pool/OracleConnectionPoolDataSource.html) is an option, but we are using c3po in our other java projects, for some reason.

 I'm leaning towards BoneCP, just to see how fast it is.

Regards,
Allan



On Saturday, July 14, 2012 1:50:37 AM UTC-7, newf wrote:
Hi, Allan

If so, you can use oracle's implicit connection pool in thin driver (see OracleDataSource  and it's properties, especially  connection­Cache­Properties  and  connectionCachingEnabled) or you can use jdbc oci driver and it's oci connection pooling.
As i know if you want third-party alternatives then BoneCP or Tomcat JDBC connection pool (it can be used standalone) can be good replacement.

Nicholas

2012/7/14 Allan <>

Allan

unread,
Jul 19, 2012, 5:20:37 PM7/19/12
to orbr...@googlegroups.com

Here are the steps to add connection pooling to OR Broker using BoneCP connection pooling in Oracle Database.

1) add the maven plugin in your pom.xml

        <dependency>
            <groupId>com.jolbox</groupId>
            <artifactId>bonecp</artifactId>
            <version>0.7.1.RELEASE</version>
        </dependency>

NOTE: make sure you have the oracle driver  and slf4j-log4j12 in your pom.xml

2) instantiate the BoneCPDataSource and set the property file (example and details can be found here - http://jolbox.com/ )

    val ds = new BoneCPDataSource()
    ds.setJdbcUrl(jdbcUrl)
    ds.setUsername(userName)
    ds.setPassword(password)
    ds.setMaxConnectionsPerPartition(minConnectionPerPartition)
    ds.setMaxConnectionsPerPartition(maxConnectionPerPartition)
    ds.setPartitionCount(partitionCount)


3) set your broker config with that data source define in step 2.

    val config = new BrokerConfig(ds)


4) To verify your connection pool you can execute this command:

netstat -na | grep "1521" | sort
Reply all
Reply to author
Forward
0 new messages