• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
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"
url="jdbcracle:thin:@127.0.0.1:1521:mysid"
username="scott" password="tiger" maxActive="20" maxIdle="10"
maxWait="-1"/>



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>"
auth="Container"
type="oracle.jdbc.pool.OracleDataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbcracle:thin:@<host>:<port>:<sid>"
[user=<user>]
[password=<password>]
maxActive="20"
maxIdle="10"
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 ?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic