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.
| Author |
Topic |
|
Kleber
Yak Posting Veteran
67 Posts |
Posted - 2004-11-09 : 13:05:59
|
| HiI 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, coneresponse.expires = 0response.buffer = trueset con=Server.CreateObject("ADODB.connection")con.CommandTimeout = 150con.ConnectionTimeout = 150con.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 regardsKleber GomesBrazil |
|
|
samamun001
Starting Member
17 Posts |
Posted - 2004-11-09 : 23:17:59
|
| why not setcon.CommandTimeout = 15con.ConnectionTimeout = 30 |
 |
|
|
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. RegardsSachin Samuel |
 |
|
|
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. |
 |
|
|
Kleber
Yak Posting Veteran
67 Posts |
Posted - 2004-11-10 : 06:18:52
|
| Thanks for your helpLet's see the results:Changing the code as suggested doesn't works. The problem continuesI 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 helpThanks in advanceKleber GomesBrazil |
 |
|
|
dsdeming
479 Posts |
Posted - 2004-11-10 : 08:19:48
|
| Can you ping the SQL Server from the web server?Dennis |
 |
|
|
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. |
 |
|
|
|
|
|