• Post Reply Bookmark Topic Watch Topic
  • New Topic

Datasources connection pooling setups-whats the difference in these two approaches  RSS feed

Atul Mishra
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I am using datasources[set up a datasource in Tomcat] like this:

<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
username="scott" password="tiger" maxActive="20" maxIdle="10"

and then using it with a factory class implementation like this:

public DataSource getDataSource() throws NamingException {

if (ds == null) {

InitialContext ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
ds = (DataSource) envCtx.lookup("jdbc/testDB");


return ds;

// get the SQL connection from the database
public Connection getConnection() throws NamingException, SQLException {
return getDataSource().getConnection();


Now I was reading about using oracle.jdbc.pool package and thereby setting up a datasource in tomcat like this:

<Resource name="jdbc/<alias>"
maxWait="-1" />

What is the difference between this implementation with the other implementation ? For our case[have30000 concurrent users which will be say 5000 concurrent DB hits] will it be beneficial to use the second approach ?

Can anyone give my some links for a Factory implementation using the second approach then ?
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!