I have server that runs windows 2003 that has my web app on it. I have another server which has SQL Server Management Studio and has my database on it.
I am having a problem connecting to the database. I had to go through a lot of trial and error to get to where I am now. I am not going to list all the things I did unless someone requests because I don't know if it is relevant to my error or not.
But I am trying to connect to my database through PHP but keep getting the following error.
Array | |
( | |
[0] => Array | |
( | |
[0] => 28000 | |
[SQLSTATE] => 28000 | |
[1] => 18456 | |
[code] => 18456 | |
[2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'admin'. | |
[message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'admin'. | |
) | |
[1] => Array | |
( | |
[0] => 42000 | |
[SQLSTATE] => 42000 | |
[1] => 4060 | |
[code] => 4060 | |
[2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot open database "Mydb" requested by the login. The login failed. | |
[message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot open database "Mydb" requested by the login. The login failed. | |
) | |
[2] => Array | |
( | |
[0] => 28000 | |
[SQLSTATE] => 28000 | |
[1] => 18456 | |
[code] => 18456 | |
[2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'admin'. | |
[message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'admin'. | |
) | |
[3] => Array | |
( | |
[0] => 42000 | |
[SQLSTATE] => 42000 | |
[1] => 4060 | |
[code] => 4060 | |
[2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot open database "Mydb" requested by the login. The login failed. | |
[message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot open database "Mydb" requested by the login. The login failed. | |
) | |
) | |
I believe the server name is right, which is the IP address. It doesn't try and login in and says it cannot find the named pipe(or something like that) if i change the IP to something else.
The credentials are fine as I use the same thing to log in to SQL server management studio.
If I change the username to something random it says the login failed but doesn't return the database name and there is less info returned. So I believe it recognizing the user name.
I checked my password multiple times to make sure there wasn't a typo or anything.
The connection settings are set for windows and sql server authentication.