Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.sendRedirect and database connections

Status
Not open for further replies.

yogeshc

Programmer
Jan 8, 2001
4
US
Hello all,
I am doing a response.sendRedirect after I close the connection to my database however the connection is failing to close. Here is the code ...

int rowsAffected=sql_stmt.executeUpdate (myQuery);

sql_stmt.close();
myConn.close();

if (rowsAffected==1)
{
response.sendRedirect (response.encodeURL("ProjectHighlights.jsp?projectid=" + projectid + "&empid=" + empid ));

}

Once I call this update query multiple time's, tomcat crashes. I think it is because the redirect is occurring before the database connection has a chance to close and then it causes a memory leak on the server. Does anyone know how I can redirect with closing the connections? Thank you.
-Yogesh
 
Hii,if u have got the soln by this time please let me know the answer for it
thanx
 
make sure you arent writing any headers or html code on the page you are doing the response.sendredirect. also try somthing like this to redirect

<jsp:forward page = &quot; />

Hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top