zleviticus Posted May 21, 2008 Share Posted May 21, 2008 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 = "192.168.1.9\\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. Quote Link to comment https://forums.phpfreaks.com/topic/106687-solved-php-sql-2005-error-could-not-locate-entry-in-sysdatabases/ Share on other sites More sharing options...
zleviticus Posted May 22, 2008 Author Share Posted May 22, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/106687-solved-php-sql-2005-error-could-not-locate-entry-in-sysdatabases/#findComment-547510 Share on other sites More sharing options...
zleviticus Posted May 23, 2008 Author Share Posted May 23, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/106687-solved-php-sql-2005-error-could-not-locate-entry-in-sysdatabases/#findComment-548082 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.