-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Milan,

One followup (to your old thread) is sufficient.

On 1/1/14, 7:50 AM, Milan wrote:
> 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.

You should use a JNDI DataSource, created by the container (Tomcat).

http://blog.christopherschultz.net/index.php/2009/03/16/properly-handling-pooled-jdbc-connections/

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSxGCgAAoJEBzwKT+lPKRY+QMP/07FkDqCaViZkGXYD3y/E9s8
veHqaH8kanEi6xi6zcWxwZ2ZMdIAgS84l3BACa4njRWyHnVe7AuPaKkh9SImu8i7
0K+hdpNBPxZwCKhLPaVWR/Bi7VsuacEKY0bCXRjD/Z+cWEvpX+OLC+MsaYJchauN
a1Q0Eja2+AE1difuHEuk5B5/Po4TlrJeQzIBKn6kJU/TnJcIwLFqPtksmZu11Rjb
JJmbv9/uJDJuY1WO/We0tm+wI/a7Uv9IoYhsqgCuezVkvMKd5ETDXnPB07KK2LUo
NYYD81GITrqm+JxxN9fmiV5p1+lslp/XrOk86QBl/m+/KZVeCbur4F4HS7e1gWdS
wPiCRaVx6yp5vr8Pz7ryWaEvziaJOSmrNgBjbT7eBCjjg5dQKfWq4FE8HfOO1rpD
47ENyn5RgtQBeUztR1dKY1Kp2scEKUZ2lION0AqwaQqo4XBRrtrRkLrxtGMeP3Nl
42NrDopcuZAhY+EnTu4+OssS4uBPzKxHu6VMdUeUfb6LRtZp68q2csye4uXzpmMN
5fg0wL3CDUEGTUqnyOcGfpODXtoqLqAUgGK/naQiyqGUJVN/Sgman+6uJeseCVsX
Xq8Js93v94nmDdj2T/l406KteBVgxui33SKbiMGqBZqY8HvI/G+/dlVGrQCTZ0kf
YuZuN/WURkt297mMlwa2
=dnHj
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to