April 4, 2007 at 3:12 am
Hi, i have a great trouble in connecting to MSSQL server on a network.
we developed an application which is using a database on localhost and works fine.
Our application need to connect to the live database now which is on other machine(SQL server 2000) on our network.
Case:
-I can ping both machines with IPs and with names.
-I can connect to database on same server with my PHP script.
-I can connect to the other database which is on SQL server 2000 from Enterprise manager of the current SQL server 2005.
- BUT BUT i cannot connect it using the same details through my PHP script.
---------------------------------------------------------
$myServer = "main";
$myUser = "testadmin";
$myPass = "XXX";
$myDB = "mainserver";
$tablename="ding";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
?>
----------------------------------------------------------
Kindly help me just to connect to the database.
April 4, 2007 at 7:10 am
This is a little confusing. Are you trying to connect to sql server 2005 or sql server 2000?
Also, when you say you can connect with PHP, do you mean the PHP script can connect to the local instance of SQL Server? Be sure that the account running your PHP script doesn't have restrictions that might prevent it from making a connection.
April 4, 2007 at 8:12 am
yep, i am connecting to SQL server 2000.
ok to tell ta bit more.
I have a server with with windows server 2003 having PHP and mySQL and apache on it. we got our application there which is using apache and mySQL from this server.
We got a database which is in MS SQL 2000 server and is on different machine on internal network.
I can ping to that machine , access DB from GUI but script cannot connect. 🙁
April 4, 2007 at 10:02 am
Can you connect from the web machine to the SQL Server using query analyzer or the data sources in ODBC?
Maybe the SQL 2000 instance is named, which means you'd need servername/instance name in your connection string.
April 6, 2007 at 11:55 am
Also check in the "Properties of the Server - Security Settings" from the Server in Enterprise manager whether mixed authentication is enabled - that user you are using in your Script can only be a SQL-Account - not a Windows (Domain) Account - make that sure as well
Then its just a matter of Network Connection - check Port and Firewall
AW
Andreas
---------------------------------------------------
MVP SQL Server
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master Data Platform, SQL Server 2012
www.insidesql.org/blogs/andreaswolter
www.andreas-wolter.com
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply