I think that PDO_DBLIB is now stable :
You can download the last source at http://pecl.php.net/package/PDO_DBLIB
Microsoft SQL Server および Sybase 関数 (PDO_DBLIB)
導入
警告
PDO_DBLIB は PHP
Data Objects (PDO) インターフェイスを実装したドライバで、
PHP から Microsoft SQL Server および Sybase
データベースに対して FreeTDS ライブラリを使用したアクセスが可能となります。
この拡張モジュールは、 実験的 なものです。この拡張モジュールの動作・ 関数名・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 このモジュールは自己責任で使用してください。
Windows では、Microsoft SQL Server や Sybase データベースにアクセスする際には PDO_ODBC ドライバを使用すべきです。 Windows 版のネイティブの DB-LIB は時代遅れになっており、 スレッドセーフではない上に Microsoft にもサポートされていません。
MS SQL Server (PDO)
arnolem at free dot fr
12-Dec-2007 10:45
12-Dec-2007 10:45
Steve H
01-Jun-2006 01:24
01-Jun-2006 01:24
To connect to SQL Server 2005 Express on Windows, do it like this:
$pdo = new PDO ('mssql:host=localhost,1433;dbname=[redacted]', '[redacted]', '[redacted]');
localhost
localhost\SQLEXPRESS
localhost\1433
localhost:1433
will not work on Windows.
localhost,1433
does work.
YMMV on other OS's; try each.
Also make sure your TCP/IP Properties -> IP Addresses are correct under SQL Server Configuration Manager.
support at converters dot ru
25-Jan-2006 10:48
25-Jan-2006 10:48
If You work with MSSQL Server 7.0/2000/... under Windows and use non latin Encoding then better To use PDO_MSSQL until PDO_ODBC bugs will be fixed (MSSQL ext far more stable and usabe for PHP versions <=5.1.2).
If your MSSQL connection use strings in OEM encoding (cp866 for russian charset)
1. Run Microsoft Server/Client Network Utility on work PC and UNCHECK "DBLibrary options"/"Automatic ANSI to OEM conversion"
2. Restart Web server if needed.
graham1 dot simpson at hsbcib dot com
08-Sep-2005 04:19
08-Sep-2005 04:19
There is currently little sybase related PDO docs out there. The ones that I found often mention a spec for a dsn that is invalid. Here's how I am currently connecting to sybase ASE:
1. Compile up freetds http://www.freetds.org on top of open client;
2. Add the PDO and PD_DBLIB modules to php 5 as per the documentation; Note: I'm currently using the PDO-beta and PDO_DBLIB-beta;
3. Check mods installed ok using "pear list" and "php -m";
The documentation often says to use "sybase:" as your DSN, this doesn't work. Use "dblib:" instead. Here's an example:
<?php
try {
$hostname = "myhost";
$port = 10060;
$dbname = "tempdb";
$username = "dbuser";
$pw = "password";
$dbh = new PDO ("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw");
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}
$stmt = $dbh->prepare("select name from master..sysdatabases where name = db_name()");
$stmt->execute();
while ($row = $stmt->fetch()) {
print_r($row);
}
unset($dbh); unset($stmt);
?>
Hope this helps.