View Single Post
Old 03-28-2005, 02:18 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
My personal opinion is to never do database stuff in a JSP. To many wacky things go on to make a JSP work, and the last thing you want is a hanging database connection. I'd make the queries in a bean, and return the results as an array of Strings or something.

Also, the way I do database connection is to put them in a try . . . finally block, closing the connection in the finally section. This helps ensure that regardless of runtime exceptions, the database connection will (through best-efforts) get closed.
__________________
GitS
Belisarius is offline   Reply With Quote