Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2005, 07:19 AM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default closing connections - application pooling

Hi,

Quite new to SQL Server, but I am experiecing some problems regarding closing connections and application pooling. I am developing a site and I have it working on my own machine Windows XP, SQL Server 2000 on IIS 5.0. The hosting company that I am using are using IIS 6, a windows 2003 server.
I am getting the following error "Service Unavailable" and I have been notified by the server administrator

"It appears that you application pool has stopped because of repeated failures caused by your code. This can occur when you are not closing connections. I suggest downloading your site and running it on a windows 2003 development server with application pools to test whether you can find the fault."


I have gone over all my code and ensured that all connection are closed but my question is this:

If I open a connection, and a record set, do some actions with the record set and then close the connection, what happens if I have a response.redirect before the connection is closed? does the connection have to be closed prior to the redirect. e.g.:

Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=Northwind"
objConn.Open

Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM Table1", objConn

If rs.eof then
response.redirect ("home.asp?message=noresults")
Else
' do some actions with the recordset
.....
End if


objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing


_____________________

Should the objrs nad objconn close be stated before the response.redirect if there are no results? or does the server read all the code on the page even if it needs to redirect.

THanks.


I have cross posted in
http://p2p.wrox.com/forum.asp?FORUM_ID=55





Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening & Closing Database connections pauliehaha Classic ASP Databases 4 December 18th, 2006 08:50 AM
closing connections - application pooling goingmad Classic ASP Databases 0 September 29th, 2005 08:20 AM
Closing db connections - when/how? SoC Classic ASP Basics 11 November 23rd, 2004 05:47 PM
Closing ADO connections in new page darrenw SQL Server 2000 0 September 15th, 2003 11:48 AM
Closing connections when redirecting alldis Classic ASP Basics 3 July 30th, 2003 08:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.