PHP SQLSRV AS400 Linked Server - Authentication Failed

Hi everybody,

I'm trying to connect to a MS SQL AS400 linked server through PHP but get

Login failed for user 'myUser'.'

PHP

$serverName = "myServer"; $userName = "myUser"; $userPassword = "myPass"; $dbName = "myDB"; //AS400 linked server $conn = new PDO("sqlsrv:server=$serverName ; Database = $dbName", $userName, $userPassword);

This only happens when I point to the linked server on this server, when I point to a "normal" database on the same server I do get connected. Other odd thing's that on the SSMS I do get to run queries from the AS400 linked server.

it seems to be a like ODBC linked server need to be authenticated somehow on the SQL server:

And as result we get:

"Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Login failed for user 'myUser'., SQL state 28000 in SQLConnect in C:\inetpub\wwwroot\acceptance\index.php on line 50 Error connecting to SQL Server: invalid data source name"

try {         $mssqldriver = '{SQL Server}'; $mssqldriver = '{SQL Server Native Client 10.0}'; $mssqldriver = '{SQL Server Native Client 11.0}'; $mssqldriver = '{ODBC Driver 11 for SQL Server}'; $serverName = "myServer"; $database = "myDatabase"; $uid = "myUser"; $pwd = "myPassword"; $conn = new PDO(odbc_connect("Driver=$mssqldriver;server=$serverName;Database=$database;", $uid, $pwd) ); }

Any idea?

0
edit delete
are you sure?
asked Kelvin Morel

0 answers

Post an answer but please login first

Post Answer
  1. Please login to post answer

Similar Questions

Tagsfor this question

Forumall questions