Hi Shiv,

Thanks for your detailed reply.

What I wanted to drive home is that using this approach, you are limiting your
application to Weblogic server only. Is there any standard way of doing this, so
that it is portable across different servers??

--Sripada

Shiv Kumar wrote:

> Hi
>
> The answer is weblogic specific.
>
> Configure a database pool in weblogic.properties file.
>
>      weblogic.jdbc.connectionPool.testPool=\
>             url=...,\
>             driver=...,\
>             ....
>      # Add a TXDataSource for the connection pool:
>      weblogic.jdbc.TXDataSource.weblogic.jdbc.jts.testPool=testPool
>
> Add the following entry to ejb-jar.xml
>
>      <resource-ref>
>        <res-ref-name>jdbc/labPool</res-ref-name>
>        <res-type>javax.sql.DataSource</res-type>
>        <res-auth>Container</res-auth>
>      </resource-ref>
>
> and the following to weblogic-ejb-jar.xml
>
>      <reference-descriptor>
>        <resource-description>
>          <res-ref-name>jdbc/labPool</res-ref-name>
>          <jndi-name>weblogic.jdbc.jts.labPool</jndi-name>
>        </resource-description>
>      </reference-descriptor>
>
> Now, from the bean you can access the connection pool like this :-
>
>      Context ctx = new InitialContext();
>      DataSource ds = (javax.sql.DataSource)
>      ctx.lookup("java:comp/env/jdbc/labPool");
>      Connection conn = ds.getConnection();
>
> For accessing oracle's sequence, I have a stateless session bean which has a
> nextValue() and currentValue() method :-
>
>      -- SequenceBean.java --
>
>      public int nextValue(String sequenceName) {
>        int nextval;
>        String query = "select " + sequenceName + ".nextval from dual";
>        Statement stmt = conn.createStatement();
>        Resultset rs = stmt.executeQuery(query);
>        ..
>        ..
>        return nextval;
>      }
>
> Hope it helps.
> --
> shiv
> [EMAIL PROTECTED]
>
> Sripada Srinivas wrote:
>
> > Hi Ana,
> >
> > If you open a connection like this for every user, then the whole purpose of
> > connection pooling used by the EJB Server is lost I suppose. (In CMP).
> >
> > By the way, is there anyway, I can get access to the connection pools used by
> > the EJB Servers?? Does any of the EJB servers provide API to access the
> > connections in their connection pool??
> >
> > Regards,
> > Sripada
> >
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to