Time out for ADO.

T

Tahir aman

I am using ADO to connect to SQL 7.0. At times the connection timeout
expires. Is there any way to inrease the default time out? I think currently
its 60 secs.

Here is the code that I use to establish ADO connection.


set rs = Server.CreateObject("ADODB.RecordSet")

sCon = "DRIVER={SQL
Server};SERVER=Indy2;DATABASE=ProdProtrans;UID=xx;PWD=xxxxxxx"


Any suggestions?


Thanks


TAHIR KHAN
 
B

Bob Barrows

Tahir said:
I am using ADO to connect to SQL 7.0. At times the connection timeout
expires. Is there any way to inrease the default time out? I think
currently its 60 secs.

Here is the code that I use to establish ADO connection.


set rs = Server.CreateObject("ADODB.RecordSet")

sCon = "DRIVER={SQL
Server};SERVER=Indy2;DATABASE=ProdProtrans;UID=xx;PWD=xxxxxxx"
Two suggestions:
1. Stop using ODBC. Use the native SQL Server provider:
sCon="Provider=SQLOLEDB;Data Source=Indy2;" & _
"Initial Catalog=ProdProtrans;User Id=xx;Password=xxx"
2. Set the connection's ConnectionTimeout property. This may not have the
effect you are after. There are two processes involved in connecting to the
database server. There is the initial search through DNS to find the
database. You have no control over how long it takes this process to time
out. After this process has actually found the server, then the ADO
connection process begins. This is where the ConnectionTimeout property has
control.

HTH,
Bob Barrows
 
E

ecPunk

Tahir aman said:
I am using ADO to connect to SQL 7.0. At times the connection timeout
expires. Is there any way to inrease the default time out? I think currently
its 60 secs.

Here is the code that I use to establish ADO connection.


set rs = Server.CreateObject("ADODB.RecordSet")

sCon = "DRIVER={SQL
Server};SERVER=Indy2;DATABASE=ProdProtrans;UID=xx;PWD=xxxxxxx"


Any suggestions?


Thanks


TAHIR KHAN

Perhaps you could post your query that times out here and we could take a
look at that to improve it's performance...

Neil
 
T

Tahir aman

I am not sure if my previous message went thru or not, but I will do it
again, just to make sure.
BOB: Not that I mind using native SQL Server provider, can I use the
ConnectionTimeout property with odbc? I am asking this for my own knowledge.
I tried doing it your way and seems to be working fine.

Using native SQL Server provider is better for other reasons too or just for
time out reasons?



So can I do this or should this be valid statement? sCon = "DRIVER={SQL
Server};SERVER=Indy2;DATABASE=ProdProtrans;UID=xx;PWD=xxxxxxx
ConnectionTimeout = 300"

Thanks for your help.


Tahir Khan
 
B

Bob Barrows

Tahir said:
I am not sure if my previous message went thru or not, but I will do
it again, just to make sure.
BOB: Not that I mind using native SQL Server provider, can I use the
ConnectionTimeout property with odbc?

Yes. Why not? It's the "ADO Connection" object's ConnectionTimeout property,
not the "ADO OLEDB Connection" object's ConnectionTimeout property. ADO
object properties do not depend on what provider is being used.
I am asking this for my own
knowledge. I tried doing it your way and seems to be working fine.

Using native SQL Server provider is better for other reasons too or
just for time out reasons?

Yes. ODBC has been deprecated:
http://msdn.microsoft.com/library/en-us/ado270/htm/ado_deprecated_components.asp
So can I do this or should this be valid statement? sCon =
"DRIVER={SQL
Server};SERVER=Indy2;DATABASE=ProdProtrans;UID=xx;PWD=xxxxxxx
ConnectionTimeout = 300"


Yes, but that would mean you would still be using the obsolete ODBC provider
....

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top