Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Connection error on open connection

Author  Topic 

dgenerate
Starting Member

2 Posts

Posted - 2008-02-12 : 09:30:02
I'm currently working on a web interface using asp/sql server. Basically, it gets user input and then inserts a bunch of records into a couple different databases. (on different servers)

First thing I do is open a connection at the top of the page.
Everything works fine for the first little while, but then after a couple thousand queries (selects, inserts), it just dies on me with the following error:

Microsoft OLE DB Provider for SQL Server error '80004005' 

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

insertNewItem.asp, line 618


If I comment line 618 out, then the script runs fine.
(Keep in mind this is nested within several loops, line 618 will get executed a couple thousand times during the script)

My connections are opened at the top of the page and never closed/reopened, yet the connection error is thrown 3/4 of the way through the script, after hundreds of inserts have taken place on that same connection. The connection error is being thrown when trying to process a query, NOT when I initially open the connection.

The same query runs perfectly fine the first several hundred/thousand times, but then eventually throws an error.

If I enter an item that requires much fewer inserts, I do not get this error.


'Corp is the name of my main connection
'Config is a connection to a secondary server

checkCMenupriceQuery = "SELECT * FROM C_MenuPrice WHERE Generation = " & rsGen("Generation") & " AND List = " & rsList("List") & " AND MenuID = " & menuID

rsCheck.Open checkCMenupriceQuery, Corp '<---###Line 609

'Check if this item already exists, and if not, insert it
if rsCheck.eof then

menuPriceQuery = "INSERT INTO C_MenuPrice (Generation, List, MenuID, Price, StoreNo, Status) VALUES(" & rsGen("Generation") & ", " & rsList("List") & ", " & menuID & ", " & sprice & ",0,0)"

if b = 0 then
response.write menuPriceQuery & "<BR>"
Corp.Execute(menuPriceQuery) '<---###Line 618
else
response.write menuPriceQuery & "<BR>"
'Config.Execute(menuPriceQuery)
end if
else


I have been stuck on this problem for quite some time now. It does not seem like a timeout issue, but I have taken some precautions to be safe. My connection and command timeouts, as well as the server.ScriptTimeout are all set to 600. (The script fails within a minute or two)

dgenerate
Starting Member

2 Posts

Posted - 2008-02-12 : 10:21:20
I changed one of my recordsets on that connection to adUseClient and my issues went away?

I solved the problem, but does anyone know why/how that was affecting my queries?
Go to Top of Page

senthil_mca80
Starting Member

10 Posts

Posted - 2008-02-12 : 16:48:40
did you check the connection pooling?. as you said, you are dealing with mulitiple database in different server. so just check how many connection pooling allowed. set the connection pooling time high. also check if you have close the connection properly after every execution.

Senthil
Go to Top of Page
   

- Advertisement -