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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection Problems

Status
Not open for further replies.

GWPhoenix

IS-IT--Management
Jun 26, 2001
32
0
0
US
I am working on a number of pages which have the following connection code. When I go to load the pages in a browser (IE6), I get an "Unspecified Error" which points to the line which reads "objConn.Open", although sometimes the page loads properly only to receive the error the next time I go in.

I am connecting to an Access Database in case that matters.

What is happening and what do I need to do?

Code:
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=NOFA9"
objConn.Open

set oRS=Server.CreateObject ("ADODB.recordset")
oRS.Open "SELECT * from NOFAS", objConn
 
You probably never closed your connection. Access, unlike higher databases (ie: sql server, oracle, etc), can only handle one connection at a time. Therefore, if you never closed the connection, and if you went to connect to the database before it timed-out, you wouldn't have access to it and it'd generate an error.

Does that help? -Ovatvvon :-Q
 
Try objConn.ConnectionString = "NOFA9" instead of
objConn.ConnectionString = "DSN=NOFA9".

I'm pretty sure thats what I do anyway! Brett Birkett B.Comp
Systems Analyst
 
Thank you both! It works great now!

I am more familiar with working in SQL Server, so I have allowed myself to be careless about closing the connections.
 
SQL Server is better at handling that situation, but you're still wasting resources if you're not destroying those connections explicitly.

just fyi. :)

paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top