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)
 Timeout Expired

Author  Topic 

Kleber
Yak Posting Veteran

67 Posts

Posted - 2004-11-09 : 13:05:59
Hi

I have a simple code to stabilich a connection between my webserver and one of my SQL Server. The code is the following:

<%
' Option Explicit
' Conexao com base de dados:
Dim con, strSQL, RSTemp, objConn, cone

response.expires = 0
response.buffer = true

set con=Server.CreateObject("ADODB.connection")
con.CommandTimeout = 150
con.ConnectionTimeout = 150
con.Open "Driver={SQL Server};server=sqlserver;uid=usr;pwd=Password;Database=database;"
%>

The problem is, I have timeout expired when using the connection through my asp page. If I use the same user and password through SQL Query analyzer or Enterprise Manager I can connect without problem.

Does someone have any idea about what could be happening?


Best regards
Kleber Gomes
Brazil

samamun001
Starting Member

17 Posts

Posted - 2004-11-09 : 23:17:59
why not set
con.CommandTimeout = 15
con.ConnectionTimeout = 30
Go to Top of Page

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2004-11-09 : 23:48:12
Hi Kleber,

This is because u have explitcitly specified the con.CommandTimeout. ConnectionTimeout property indicates the time for which the server will wait for the response from the server. It avoids the "hang" mode. If the con.CommandTimeout=0 is specified then it will wait indefinitly. Please try specifying this.

Regards
Sachin Samuel
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-11-10 : 00:37:27
mmmm... I'll be a bit worried if my page doesn't even manage to connect to the db after 2.5 mins.

I think there is something else wrong people - are you sure that you have specified the correct server name etc in your connection string?

Duane.
Go to Top of Page

Kleber
Yak Posting Veteran

67 Posts

Posted - 2004-11-10 : 06:18:52
Thanks for your help

Let's see the results:

Changing the code as suggested doesn't works. The problem continues

I am sure that the user name, server and password are correct.

This code connects ok to others SQL Server (I have others SQL Servers, that some web pages access it). Because of this I think the problem is on SQL Server.

I would appreciate any help

Thanks in advance
Kleber Gomes
Brazil
Go to Top of Page

dsdeming

479 Posts

Posted - 2004-11-10 : 08:19:48
Can you ping the SQL Server from the web server?

Dennis
Go to Top of Page

Kleber
Yak Posting Veteran

67 Posts

Posted - 2004-11-10 : 08:29:14
Yes, and I also connect to SQL Server (from web server) with query analyzer. But through Web page, I receive the timeout message.
Go to Top of Page
   

- Advertisement -