jdbc connection pool

-----------------------------------
search for a property called WEBLOGIC JDBC CONNECTION POOL MANAGEMENT
-----------------------------------
uncomment the below properties if they are in comments.

# There is one statement #that set ACL to users to #use Pool of DB #connections.

weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePool=\everyone

# Below property assigns #the JNDI name to #oraclePool
weblogic.jdbc.TXDataSource.weblogic.jdbc.jts.demoPool=oraclePool

save & exit
-----------------------------------
2) open weblogic-ejb-jar.xml



shopBean

10





jdbc/demoPool

weblogic.jdbc.jts.demoPool






ejb-jar.xml
---------------


jdbc/demoPool
javax.sql.DataSource Container



In EJB class
p class Shop
----------------
public void ejbCreate(int accNo, String pass) throws CreateException
{
this.accNo=accNo;
this.pass=pass;
try
{
javax.naming.Context ctxt=new javax.naming.InitialContext();

Object o=ctxt.lookup("java:comp/env/jdbc/demoPool");

javax.sql.DataSource ds=(javax.sql.DataSource)o;

con=ds.getConnection();

stmt=con.createStatement();
}

No comments: