Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP, PDO dsn-less connection to MS-SQL 2008

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Andreas <maps.on AT gmx.net>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] PHP, PDO dsn-less connection to MS-SQL 2008
  • Date: Mon, 12 Dec 2011 01:32:14 +0100

Am 11.12.2011 15:37, schrieb Cesare Leonardi:
On 11/12/2011 08:14, Andreas wrote:
can someone help me with PHP, PDO dsn-less connection to MS-SQL 2008,
please?
This is the connection string i'm currently using to connect to MSSQL
2000 with FreeTDS 0.91 and without any external conf file:

$dbDriver = "FreeTDS; TDS_Version=7.1; port=1433";
$dbh = new PDO("odbc:Driver=$dbDriver; Server=$serverFQDN;
Database=$dbName; Uid=$usr; Pwd=$pwd;");

This didn't work either at first but then I've got it working like this:
$drv = "SQL Server; TDS_Version=8.2; Port=1433";
$dbh = new PDO( "odbc:Driver=$drv; Server=192.168.0.123; Database=xx; UID=yy; PWD=zz;" );

I tried "FreeTDS" as drivername earlier but it wouldn't work. Only now I figured out that OpenSuse registers the FreeTDS driver as "SQL Server".

Btw. is there a reason that ODBCConfig only offers TDS versions up to 7.0? AFAIK 8.0 is MSSQL 2005 so it's not really that new.


Thanks :)




Archive powered by MHonArc 2.6.24.

Top of Page