简体   繁体   中英

PHP to SQL Server without ODBC or MSSQL support

I'm in a situation where my Windows hosting has PHP support, but the PHP is not configured to support ODBC or MSSQL. I can't get them to change that, so I'm wondering if there's a way to connect to SQL Server through other means - maybe including some files that provide the functions that I'd need?

Leaving it up here in the hopes that it will make it easier for other people to get around this type of limitation.

Copied here for completeness:

<?php 
$db = new COM("ADODB.Connection"); 
$dsn = "DRIVER={SQL Server}; SERVER={SERVER};UID={USER};PWD={PASS}; DATABASE={DB}";
 $db->Open($dsn); 
$rs = $db->Execute("SELECT * FROM table"); 

while (!$rs->EOF) 
{ 
    echo $rs->Fields['column']->Value."<BR>"; 
    $rs->MoveNext(); 
} 
?> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM