I hadn't noticed that ResultSets need to be closed. But why couldn't I close it after dealing with it in whichever servlet I call it from?

Also, if the Connection is a static variable in SQLUtils that all the servlets use, it won't ever get closed.

I'm just realizing that there's probably a major scalability issue here that I need to worry about, but I'm still thinking this has to be easier...

Todd

P.S. A little context, so you all don't tell me to get another job. I teach high school math and computer science, and in one of my advanced classes we decided to create a webapp. One group is working on the database backend and another group is writing Velocity templates to display the information. I'm learning as we go, because I've written about 5 or 6 total servlets since last summer. I've got the Java Servlets book and the JDBC book from O'Reilly, but I haven't had time to read them cover to cover, so there may be gaps in my knowledge. All my database knowledge has also been picked up since last summer, and I spend maybe an hour a day actually writing code.

My concern is that we set this up in a way that is sound, but perhaps more importantly, clean and easy to understand. Since it's me and a bunch of high school seniors who'll be messing up the code, something straightforward seems the way to go.

Thanks again for your patience.

On Dec 3, 2003, at 12:27 PM, Christopher Schultz wrote:

Todd,

SQLUtils.executeQuery("a SQL statement");
SQLUtils.executeUpdate("another one");

Just out of curiosity, what do these methods return? If the former returns a ResultSet object, then you're in for a world of trouble. The ResultSet will never get closed, or you'll close the connection over which the ResultSet communicates, and then you're hosed, 'cause the calling code can't access the data.


-chris


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to