Hello all.
A typically ejbStore() method (assuming bean-managed persistence) might
look like this...
public void ejbStore()
{
InitialContext context = new InitialContext();
DataSource ds = (DataSource)context.get("/some/jndi/name");
Connection conn = ds.getConnection();
PreparedStatement stmt = conn.preparedStatement("update bleah set
colOne = ?, colTwo = ? where colThree = ?")
...
conn.close();
}
Now...
1. Most of the EJB books show the Connection that is obtained from the
DataSource being closed at the end of the method. Why? If the EJB server is
responsible for maintaining a pool of database connections, then surely it
alone should be responsible for adding and removing Connections from this
pool.
2. Is there any way to take advantage of good JDBC drivers, that work with
the database to construct the query plan for PreparedStatements ONCE (when
they are constructed) rather than every single time they are constructed?
Regards,
James W.
--------------------------------------------------------------------------
Be sure to check out the careers section of our web site to see
how you could be eligible for a $2000 reward.
http://www.cardsetc.com/
--------------------------------------------------------------------------
This e-mail is from Cards Etc Pty Ltd (ACN: 069 533 302). It may contain
privileged and confidential information. It is intended for the named
recipient(s) only. If you are not an intended recipient, please notify us
immediately by reply e-mail or by phone on +61 2 9212 7773 & delete this
e-mail from your system.
--------------------------------------------------------------------------
===========================================================================
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".