• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory leaks

 
Josiel Oliveira
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All.
I have a JSP page that:
1 - makes a call to a bean method that returns a PreparedStatement;
2 - creates a ResultSet from the PreparedStatement;
3 - Show the data;
4 - closes the resultset;
5 - closes the preparedStatement
No matter what I do, the client process (browser) grows in memory every times that page is loaded. The connection is static, and I use always the same, for saving time to connect. In the Task Manager, I can see that the client process left behind always one handle.
This is a example of the JSP.
<%
PreparedStatement stmt = ConnectionFactory.getQuery("select * from usuario");
ResultSet qryData = qry.executeQuery();
%>
After I have a while loop showing the data
... and finally:
<%
qryData.close();
stmt.close();
%>
Am I forgeting something?
 
Silvio Pedroso
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In spite this is not really an explanation for your question, I couldn�t get away without suggesting you to:
1) forget using jsp in this way as this is a presentation layer;
2) create a java bean to access your database and feed a hashtable and retrieve it from your page.
Safe and easy as well as mature and polite.
 
Josiel Oliveira
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Silvio Pedroso:
In spite this is not really an explanation for your question, I couldn�t get away without suggesting you to:
1) forget using jsp in this way as this is a presentation layer;
2) create a java bean to access your database and feed a hashtable and retrieve it from your page.
Safe and easy as well as mature and polite.

Thanks, but the problem is that I have a lot of pages implemented this way. If I have a chance to keep them...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic