简体   繁体   中英

MS SQL 2000 ODBC PHP slow connect() and slow odbc_fetch_row()

When i odbc_connect() to MS SQL with PHP using ODBC in local network(not host) , the connection takes about 11 seconds . Here is the code of my connection:

function __construct(){
    $connstr = "Driver={SQL Server};Server=serv;Database=Base;";
    $this->lnk = odbc_connect($connstr, "login", "passs");
}

And when i odbc_fetch_row() it also takes about 5 seconds . Here is my result function code:

function manual($query){
    $result = odbc_exec($this->lnk, $query);// or exit(odbc_error);
    for($i = 1; $i<odbc_num_fields($result)+1; $i++){
        $arr_row[] = odbc_field_name($result,$i);
    }
    while(odbc_fetch_row($result)){
        foreach($arr_row as $name){
            $ownsql_result[$name][] = trim(odbc_result($result, $name));
        }
    }
    odbc_free_result($result);
    return $ownsql_result; 
}

Im Using WAMP on Windows 7 and MS SQL 2000 on other PC Windows Server 2003 in same local network ... Plz guys help out

We were using SQL Server 2000 up to last year and php's MSSQL librairy was working fine. Try to switch from ODBC to MSSQL.

问题出在MSSQL SERVER VERSION中...我将其从2000更改为2005,并且全部正常工作

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