You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Papo Napolitano <pa...@dosalcubo.com> on 2001/10/02 16:31:26 UTC

ejb mysql ejbPassivate() - NEWBIE QUESTION -

I'm trying to write an Session EJB to administrate users in a Database.

I've written it and connect to mySql in this way :

----------------------------  CODE ----------------------------------

  public int dbConnect() {

   try {
      Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    } catch(Exception e){
      return 100;
    }

   try{
      this.dbConnection =
DriverManager.getConnection("jdbc:mysql://localhost/bcu","user","pass");
    } catch(SQLException e) {
   return 101;
    }
   return 0 ;
  }

----------------------------  END CODE ----------------------------------


This work ok, but It remains connected and returns error when jboss try to
passivate the EJB.

So.. I want to know how can I refer to my ejb to make a dbConnection.close()
from the ejbPassivate() ??? and connect on ejbActivate().

Regards,

Papo