Access SQL Database From ASP
I have two websites OLD.com (classic ASP) and NEW.com (ASP.NET) - each site has its own SQL database which it can access just fine. However I need to access the OLD.com & NEW.com databases from classic asp written in OLD.com.
Here is the code i'm using in OLD.com to access NEW.com's DB:
Dim oCN
Set oCN = Server.CreateObject("ADODB.Connection")
oCN.Open "Provider=SQLOLEDB;Data Source=NEW.COM DB IP;Initial Catalog=dbname;User ID=uname;Password=pAss;Pooling=False"
This works just fine on my local IIS machine, but when I upload it to OLD.com it times out and gives this error:
Active Server Pages error 'ASP 0113'
Script timed out
How can this be? Whats w开发者_JAVA百科rong?
Many thanks for your help
Start with the classic debugging questions - does the OLD.com have network access to the database; if you have query analyser on that server can you open a sql connection using that username and password; are username and password typed correctly etc.
What query are you then performing? The error indicates a script timeout - are you trying to retrieve something that is taking longer than the timeout - inefficient query, etc.
EDIT - for example - can the IP address of the new database be accessed from the old server? Is there a firewall in place preventing the sql connection from one site to the other (web traffic will be allowed over port 80, not sure what port the sql connection will be going over, but may well be being blocked by either your old or new hosting providers
精彩评论