note 107128 added to ref.pdo-odbc
| From: | ArizJacinto at osu1 dot php dot net | Date: | Mon, 09 Jan 2012 21:50:06 +0000 |
| Subject: | note 107128 added to ref.pdo-odbc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185505@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);
?>
For more info, visit: http://blog.acjacinto.com/2011/11/compiling-php-with-mssql-servers-native.html
----
Server IP: 64.71.164.2
Probable Submitter: 216.190.27.195
----
Manual Page -- http://www.php.net/manual/en/ref.pdo-odbc.php
Edit -- https://master.php.net/note/edit/107128
Del: integrated -- https://master.php.net/note/delete/107128/integrated
Del: useless -- https://master.php.net/note/delete/107128/useless
Del: bad code -- https://master.php.net/note/delete/107128/bad+code
Del: spam -- https://master.php.net/note/delete/107128/spam
Del: non-english -- https://master.php.net/note/delete/107128/non-english
Del: in docs -- https://master.php.net/note/delete/107128/in+docs
Del: other reasons-- https://master.php.net/note/delete/107128
Reject -- https://master.php.net/note/reject/107128
Search -- https://master.php.net/manage/user-notes.php