Skip to content Skip to sidebar Skip to footer

Using Pdo's Odbc To Connect To A Mssql Server Instance With Windows Authentication

I'm trying to connect to a MSSQL database using PDO with odbc. I'm aware that there's a package SqlSrv (but for some reason that package (.dll) won't load properly). So I found som

Solution 1:

Try removing the username & password

$conn = new PDO(
    'odbc:
        Driver=SQL Server;
        Server=MyServer\MyInstance;
        Database=MyDatabaseName;
        Trusted Connection=Yes;'
);

Solution 2:

I have authenticated by Windows with following PHP statement: This is my code:

$Conn=newPDO ("odbc: Driver = {SQL Server}; Server=JAMILI-PC\SQLEXPRESS; null; null");
  • I am using Windows 2008.
  • I hope it solves your problem.

Post a Comment for "Using Pdo's Odbc To Connect To A Mssql Server Instance With Windows Authentication"