Jump to content

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 = "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.

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. 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.