note 107128 modified in ref.pdo-odbc by danbrown

From: Date: Tue, 10 Jan 2012 20:17:06 +0000
Subject: note 107128 modified in ref.pdo-odbc by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185552@lists.php.net to get a copy of this message
Using SQL Server Native Client 11.0 on Linux as a PDO_ODBC driver: Download the SQL Server Native Client 11.0 on Linux ODBC Driver: http://www.microsoft.com/download/en/details.aspx?id=28160 Configuration ODBC: /usr/local/etc/odbcsys.ini -- [SQL Server Native Client 11.0] Description = Microsoft SQL Server ODBC Driver V1.0 for Linux Driver = /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1720.0 UsageCount = 1 /usr/local/etc/odbc.ini -- [MSSQLServer] Driver = SQL Server Native Client 11.0 Description = Sample Database Trace = Yes Server = Port = 1433 Database = Test the connection: mssqltest.php -- <?php putenv('ODBCSYSINI=/usr/local/etc'); putenv('ODBCINI=/usr/local/etc/odbc.ini'); $username = ""; $password = ""; try { $dbh = new PDO("odbc:MSSQLServer", "$username", "$password" ); } catch (PDOException $exception) { echo $exception->getMessage(); exit; } echo var_dump($dbh); unset($dbh); ?> --was-- Using SQL Server Native Client 11.0 on Linux as a PDO_ODBC driver: Download the SQL Server Native Client 11.0 on Linux ODBC Driver: http://www.microsoft.com/download/en/details.aspx?id=28160 Configuration ODBC: /usr/local/etc/odbcsys.ini -- [SQL Server Native Client 11.0] Description = Microsoft SQL Server ODBC Driver V1.0 for Linux Driver = /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1720.0 UsageCount = 1 /usr/local/etc/odbc.ini -- [MSSQLServer] Driver = SQL Server Native Client 11.0 Description = Sample Database Trace = Yes Server = Port = 1433 Database = Test the connection: mssqltest.php -- <?php putenv('ODBCSYSINI=/usr/local/etc'); putenv('ODBCINI=/usr/local/etc/odbc.ini'); $username = ""; $password = ""; try { $dbh = new PDO("odbc:MSSQLServer", "$username", "$password" ); } catch (PDOException $exception) { echo $exception->getMessage(); exit; } echo var_dump($dbh); unset($dbh); ?> For more info, visit: http://blog.acjacinto.com/2011/11/compiling-php-with-mssql-servers-native.html http://php.net/manual/en/ref.pdo-odbc.php

« previous php.notes (#185552) next »