||Creating a Web Application with Ant and Tomcat 4|
|Subject:||Good article, maybe, but terrible code|
I think the AddressDB class is a good example of how NOT to use JDBC in a J2EE environment (such as Tomcat 4). It's ironic that the author mentioned the KISS principle, only to then solve the problem of getting access to a DB connection by a lot of unnecessarily complicated code. The correct solution would be to have used the connection pooling provided by Tomcat, which can be configured in the conf/server.xml file. In the code, all that is needed is to open the connection (using DataSource) at the beginning of a the method, and then close it in a finally block.
Showing messages 1 through 1 of 1.
Good article, maybe, but terrible code
2003-01-14 15:48:02 woodp [View]