Connection pooling..

Hi I'm using an oracle database for my multi threaded Java application. I need to have a multiple database connections for several threads in that application.

Is it ok to use Connection pooling for this purpose ?

Currently Im facing some performance issue in using single connection.

I need to release all my Statements and ResultSets objects without closing them manually within a finally block. Is there any way to do this?

I cannot close my database connection and re establish it as several threads using the same connection same time.

Thanks

Pathum

[599 byte] By [Pathuma] at [2007-11-27 10:47:22]
# 1

> without closing them manually within a

> finally block.

Why?

> I cannot close my database connection and re

> establish it as several threads using the same

> connection same time.

That's just bad design. Use connection pooling and don't share connections among threads.

BalusCa at 2007-7-28 20:24:31 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Thanks for ur reply.

Yeah. my design may have some loop holes. Now I'm trying to overcome those. Thats why I asked ur help.

Could you please let me know how I should use connection pool in my application?

I followed

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/conpool.html

I can understand the theory there but can't understand how I use it practically

Please help me on this.

Pathuma at 2007-7-28 20:24:31 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

That artical is about theory.

If all you want is to use a connection pool in your application better to use an existing one instead of developing your own connection pool

Take a look at commons-DBCP project. You can use that in your application.

http://jakarta.apache.org/commons/dbcp/

LRMKa at 2007-7-28 20:24:31 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

If it is a webapp on an application server, then rather use datasources. Enter the administration console of the appserver and create a connection pooling datasource. Then you can access it by JNDI inside the webapp.

BalusCa at 2007-7-28 20:24:31 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

Thanks Guys

I think I found a better wrapper for this

http://sourceforge.net/projects/proxool/

I'll do some testings and let u guys know ..

thanks anyway...

Pathuma at 2007-7-28 20:24:31 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...