Hi
below is an example of how to deal with connections when using weblogic

  public void ejbStore() {

    Connection con = null;
    PreparedStatement ps = null;

    try {
      con = getConnection();// gets the connection from the connection pool
created by weblogic
      ps = con.prepareStatement("update ejbAccounts set bal = ? where id =
?");
      ps.setDouble(1, balance);
      ps.setString(2, accountId);
      if (!(ps.executeUpdate() > 0)) {

        throw new NoSuchEntityException (error);
      }
    } catch(SQLException sqe) {
      log("SQLException:  " + sqe);
      throw new EJBException (sqe);
    } finally {
      try
      {
          ps.close();
        con.close();//returns it back to the pool
      }
      catch(Exception e)
      {
          e.printStackTrace();
      }
    }
  }

This thing should be followed in all the create find and remove methods
HTH
Anamitra

-----Original Message-----
From: suresh gopal [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 22, 2000 2:03 PM
To: [EMAIL PROTECTED]
Subject: Re: Database Connection


When you are using a web application (Servlets/JSP) to
call EJB - you have to make sure that a calls to a
single EJB should not span multiple pages. If this
happens,you might some times never visit a page or
reload couple of times, which make more open
connections.


gopal
--- Simon Blake <[EMAIL PROTECTED]> wrote:
> Absolutely do NOT do this!
>
> create is called on insert of the new row in the
> table (RDBMS speak I know),
> remove is called on delete. Your mechanism would
> have a new database
> connection for every single row in the table!
>
> ----- Original Message -----
> From: "Nittle Gupta" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, June 22, 2000 11:27 PM
> Subject: Re: [EJB-INT] Database Connection
>
>
> > Hello Shyam,
> >         In BMP entity beans, the callback methods
> are implemented. Open
> the
> > database connection in ejbCreate() method and
> close it in ejbRemove()
> > method.
>
>
===========================================================================
> 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".
>


__________________________________________________
Do You Yahoo!?
Send instant messages 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".


STATEMENT OF CONFIDENTIALITY.   The information contained in this electronic
message and any attachments to this message are intended for the exclusive
use of the addressee(s) and may contain confidential or privileged
information. If you are not the intended recipient, please notify
USPowerSolutions Corporation immediately at (617) 547-3800, or at
[EMAIL PROTECTED], and destroy all copies of this message and any
attachments.

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