posted 24 years ago
according to "maintained by bean",i guess that you means BMP,if then,you can first set up your own connection pool in application server,and get one connection per time via jndi name.i write my codes like the following:
private Connection getConnection() throws SQLException {
try
{
Context jndiCntx = new InitialContext();
DataSource ds =(DataSource)jndiCntx.lookup("java:/mySQLDS");
return ds.getConnection();
}
catch (NamingException ne)
{
throw new EJBException(ne);
}
}
besides,make sure that connection is released after used it per time,for example,in ejbCreate() or ejbStore(),before quiting methods remember to invoke close() on connection.
hope this will be helpful!
[ January 10, 2002: Message edited by: bin jian ]
[ January 10, 2002: Message edited by: bin jian ]