View Full Version : Hosting an app on a different server and connecting to DiscountASP's MSSQL
OskarK
02-15-2007, 08:35 AM
Is it possible to connect to DiscountASP's MSSQL db when the script is located on a different server?
I am using this to connect:
$ConnString="DRIVER={SQL Server};SERVER=tcp:mssql01.discountasp.net;DATABAS E=********";
It is running fine while local and the error I am getting is this:
Warning: odbc_connect(): SQL error: [Microsoft][ODBC SQL Server Driver]Client unable to establish connection, SQL state 08001 in SQLConnect
wisemx
02-15-2007, 08:44 AM
I do it all the time from ASP and ASP.NET...What scripting language/page are you using?
bruce
02-16-2007, 07:38 AM
this most likely means that the server/network hosting the application blocks 1433 port.
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
OskarK
02-21-2007, 07:03 AM
Here is a little update. I managed to connect to the database on DISCOUNT ASP from our serverruning php (4.3.8)using odbc_connect()
this is the error message that I am getting:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permission denied on object 'sp_cursoropen', database 'master', owner 'dbo'., SQL state 42000 in SQLExecDirect in xxxxxxxxxxxxxxxxxxxxxxxxxxxxx on line 14
Here is how I connect:
$conn=odbc_connect('SYSTEM_DSN_NAME','username','p assword');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT id, firstname, lastname FROM dbo.tablename";
$Result=odbc_exec($conn,$sql);
System DSM is actually using the root account to login.
What am I missing?
Thanks,
bruce
02-21-2007, 10:10 AM
looks like your application is trying to access the master database which is not permitted.
check your DSN setting to make sure you point the default database to your database.
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
OskarK
02-21-2007, 10:20 AM
It is that's part of the problem.
The default database is set to our.
bruce
02-21-2007, 10:41 AM
well.. not according to the error. The error says you are trying to do something in the master db.
Try change your query to
SELECT id, firstname, lastname FROM [yourdatabaseName].dbo.tablename
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
vBulletin® ©Jelsoft Enterprises Ltd.