Define your getConnection like below in your bean class.

private Connection getConnection()
    throws SQLException
  {
    InitialContext initCtx = null;
    try {
      initCtx = new InitialContext();
      DataSource ds = (javax.sql.DataSource)
        initCtx.lookup("java:comp/env/jdbc/oraclePool");
      return ds.getConnection();
    } catch(NamingException ne) {
      System.out.println("Failed to lookup JDBC Datasource. Please
double check that");
      System.out.println("the JNDI name defined in the
resource-description of the ");
      System.out.println("EJB's weblogic-ejb-jar.xml file is the same as
the JNDI name ");
      System.out.println("for the Datasource defined in your
config.xml.");
      throw new EJBException(ne);
    } finally {
      try {
        if(initCtx != null) initCtx.close();
      } catch(NamingException ne) {
        System.out.println("Error closing context: " + ne);
        throw new EJBException(ne);
      }
    }
  }

and make the following changes in your ejb-jar.xml file.
  <resource-ref>
                 <res-ref-name>jdbc/oraclePool</res-ref-name>
                 <res-type>javax.sql.DataSource</res-type>
                 <res-auth>Container</res-auth>
 </resource-ref>

and give a JNDI name for the resource in your weblogic-ejb-jar.xml file.
Hope this helps u.


-----Original Message-----
From: G. Srinivasa Murthy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 4:55 PM
To: [EMAIL PROTECTED]
Subject: Entity Bean Example


Hi guys,

Can someone send me an Entity bean example with Oracle/SQL as the back
end
in WebLogic. The examples in Weblogic, do not use any of these servers
but
only uses weblogic's native database. Could someone help me with this or
let
me know the site where I can find it.

Thanks in advance and i am sorry for asking such a basic doubt.

Srinivas.

========================================================================
===
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