Jump to content

[SOLVED] PHP sql 2005 error: could not locate entry in sysdatabases...


Recommended Posts

I am having an issue with php and my 2005 sql server. When i connect to the database via visual basic through an excel macro i can connect just fine and do whatever i want to get the data i need.  When i try to connect using php code i am getting the "Could not locate entry in sysdatabases for database 'mydb'/ No entry found with that name.


I have tried connecting using windows autentication and SQL. Same issue. I did have to replace a dlll for php because of a known issue with mssql and php 5. I am also connecting using the port address of the server in the sql_connect.  Also the server is an named instance and not the default instance.  I am at a loss as to what is causing the issue.  The same code worked on a sql 2000 server with php 5. This 2000 sql is on the same server as the 2005 in another instance.


Here is what i am using to connect to the server:


$server = "\\instance,1433";
$username = "someuser";
$password = "somepassword";
$sqlconnect = mssql_connect($server, $username, $password) or DIE("Can't Connect to server.");
$sqldb = mssql_select_db('MyDB', $sqlconnect);


oh on a side note when i run a  sp_helpdb against master i can see the DB i am trying to connect to listed.

Link to comment
Share on other sites

Ok more info.. I think i foudn what is going on but trying to figure out how to fix. It looks like the code is only looking at the default server instance and not the named. i connected to the database and ran a select on the master.dbo.sysdatabases through the code and it is showing DBs from the default instance.  So we are getting closer. 

Link to comment
Share on other sites

Wow the issue was a combination of permission and weirdness. When i tried to connect using the instance name and port it would connect to the default instance of sql 2000 on the server. When i got rid fo the port # it connected up to the correct instance. That was AFTER i did some permission changes and such.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.