tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milan" <>
Subject DBCP : Best practice javax.sql.DataSource object and Connection Object creation in Web Application
Date Wed, 01 Jan 2014 12:50:29 GMT
Dear All,


I would like to know that what is the best practice or efficient way to
create  javax.sql.DataSource object


A)     Following is my practice.

-          Using DBCP, I created javax.sql.DataSource and connection object
for each call to method in my class.

-          Right now I am facing oracle session blocking problem.


B)      I am going to implement following practice

-          Creating only one object of javax.sql.DataSource using singleton
pattern for whole application.

-          Using that single javax.sql.DataSource object I will create
connection object of each method call and close the connection after
transaction is finished.


Please advise me on B) practice.  Is there anything I am missing or how does
B) impact on my DB transaction.


Thanks and Regards,


Milan Dalsaniya



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message