Thanks, Wojtek. I appreciate the tip. I'll make the changes
accordingly. ~Sisilla
requestobject. That way the reference goes away when the JSP is finished
Storing a connection is a really REALLY bad idea.
Even if it is just the request object, its still a bad idea.
You should use connection pooling. It will take manage
your connections for you. It will try to reuse connections
so you can improve performance.
The code i use goes something like this:
public Connection getConnection(String name) throws Exception {
Context initCtx = new InitialContext();
DataSource ds;
if ( useEnv ) { // tomcat needs this, but websphere doesnt, i am no jndi expert so i am not sure why.
initCtx = (Context)initCtx.lookup("java:comp/env");
}
// this is the connection pool name you have defined, something usually like jdbc/poolName
ds = (DataSource)initCtx.lookup(name);
return ds.getConnection();
}
good luck.
..
=====================================================
THIS IS MY SIGNATURE. There are many like it, but this one is mine.