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