i wrote a BMP bean to insert values in to the database.
the following is the code.
In setEntityContext Method..
public void setEntityContext(EntityContext ctx)
In getConnection Method....
public Connection getConnection()throws SQLException
Context c=new InitialContext();
but iam getting an error as unable to connect to the database "java:comp/env/jdbc/oraclePool"
so can u people tell me what is wrong with code
Check deployment descriptor for the resource ref tags.
XXX- refers to connection cache on your Application server.
i did not understand the reply because i did not find anything related to<res-link>xxx</res-link>in any book.
ao please let me know what exactly it is and more ever we can work with BMP without writing any deployment descriptor.
so please let me know.
I don't think it's a good idea to get the connection in the "setEntityContext" method. Because of the limit of the number of database connection resource. When the EJB container starts, it'll initiate some pooled Entity Bean Object by calling the setEntityContext method. So, if number of the pooled entity bean instance is larger than the limit of connection of your database, no more connection could be established. I suggest to get the connection as late as possible, for example, get them in the ejbActivate method.