davidc3084 Posted March 14, 2007 Share Posted March 14, 2007 Environment - Windows XP Professional Client running Apache 2.x w/ PHP5. Accessing a Remote SQL Server 2000 DB. Can Access SQL Server DB w/ standard SQL Server Query Analyzer Tool. php.ini has the following extensions (in which all dll have been copied to PHP root) php_pdo_mssql.dll, php_msql.dll, php_mssql.dll. Attempting to access w/ COM approach. Tried mssql_connect, mssql_pconnect both w/ DSN, TCPIP and Name Piples. Cannot seem to make connection. Below is a snippet of the code. I think it is a networking, infrastructure issue, but cannot debug. Q: Is there anyway to track - how and why the connection is failing? At this point I just know it errors out. So its really tough to debug. <html> <head> <title>PHP Test</title> </head> <body> <h1> SQL/PHP /<h1> <?php $HOST = "CSCS02"; $USER = "sa"; $PASS = "mypswd"; $DB = "MY_DB_A"; $dsn = "Provider=SQLOLEDB;Data Source=$HOST;UserId=$USER;Password=$PASS;Initial Catalog=$DB"; $charPage = CP_UTF8; $db = new COM("ADODB.Connection", NULL, $charPage); $db->Open($dsn); echo "made it"; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/42759-solved-ms-sql-2000-wphp5-using-ole/ Share on other sites More sharing options...
aurheim Posted March 23, 2007 Share Posted March 23, 2007 Use SQL Server Configuration Manager to check if it is configured to handle any TCP/IP, VIA and Named Pipes traffic. I belive that it will not handle any trafic default afther installlation. You will find the util under Configuration Tools under your sqlserver folder. Quote Link to comment https://forums.phpfreaks.com/topic/42759-solved-ms-sql-2000-wphp5-using-ole/#findComment-213530 Share on other sites More sharing options...
davidc3084 Posted March 28, 2007 Author Share Posted March 28, 2007 Problem solved. Lack of SQL Server experience on my part - more an Oracle person. Evidently the user SA is a special type of user account that has access to catalogues (i.e. i could connect to Query Analyzer), but is not considered a valid db user. Create a user in my targeted DB and all worked. Quote Link to comment https://forums.phpfreaks.com/topic/42759-solved-ms-sql-2000-wphp5-using-ole/#findComment-216744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.