Thread-safety in javax.jdbc.DataSource?
843854Oct 15 2003 — edited Mar 1 2004
Hi.
I am using Tomcat with an Oracle DB, and using the Oracle DataSource and thin client implementation for my connection pooling. I am wondering if the javax.sql.DataSource class is threadsafe. That is, if I have a DataSource defined for my application in Tomcat's server.xml, and have code...
javax.sql.DataSource ds = null;
javax.naming.Context ctx = null;
java.sql.Connection conn = null;
ctx = new InitialContext();
ds = (DataSource)ctx.lookup("myDataSource");
conn = ds.getConnection();
... if two threads execute this code at the same time, will there be any threading problems? Will ds.getConnection() blowup? Or will two clients get different instances of DataSource that are not inter-dependant? Is this application server specific?
Could someone post a URL to someplace that discusses threading issues in these cases? Thanks.