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 et Fonctions Sybase (PDO_DBLIB)
Introduction
Avertissement
PDO_DBLIB est un pilote qui implémente l'interface de PHP Data Objects (PDO) pour
autoriser l'accès de PHP au Microsoft SQL Server et aux bases de
données Sybase par la bibliothèque FreeTDS.
Ce module est EXPERIMENTAL. Cela signifie que le comportement de ces fonctions, leurs noms et, concrètement, TOUT ce qui est documenté ici peut changer dans un futur proche, SANS PREAVIS ! Soyez-en conscient, et utilisez ce module à vos risques et périls.
Sur Windows, vous devriez utiliser le pilote PDO_ODBC pour se connecter sur le Microsoft SQL Server et les bases de données Sybase, puisque le DB-LIB natif de Windows est vieux, les threads sont dangereux et n'est plus supporté par Microsoft.
Sommaire
- PDO_DBLIB DSN — Connexion au Serveur Microsoft SQL et bases de données Sybase
MS SQL Server (PDO)
arnolem at free dot fr
12-Dec-2007 05:45
12-Dec-2007 05:45
Steve H
31-May-2006 09:24
31-May-2006 09: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 05:48
25-Jan-2006 05: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 12:19
08-Sep-2005 12: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.
