php连接odbc的问题
ahlwz 2006-09-21 10:01:49 源代码:
//错误处理函数
function Error_Handler( $msg, $cnx )
{
echo "$msg \n"; // 为避免占用连结, 在程序结束前close掉是很重要的.
odbc_close( $cnx); //line 61
exit();
}
// 建立一个 ODBC 连结, 传回至 $cnx
$cnx = odbc_connect( 'WebDB' ,'webuser', 'webpassword',); //line 66
//$cnx = @odbc_connect( 'WebDB' ,'webuser', 'webpassword',SQL_CUR_USE_ODBC);//已测试过无效
echo $cnx;
echo "<br>";
//.....
错误如下:
Warning: odbc_connect(): SQL error: , SQL state 00000 in SQLConnect in d:\usr\www\html\login\export.php on line 66
在 odbc_connect 有错误发生
Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in d:\usr\www\html\login\export.php on line 61
WebDB设置的为access文件,文件的权限已经设置为完全控制
php.ini相关odbc配置如下:
[ODBC]
;odbc.default_db = WebDB
;odbc.default_user = webuser
;odbc.default_pw = webpassword
; Allow or prevent persistent links.
odbc.allow_persistent = On
; Check that a connection is still valid before reuse.
odbc.check_persistent = On
; Maximum number of persistent links. -1 means no limit.
odbc.max_persistent = -1
; Maximum number of links (persistent + non-persistent). -1 means no limit.
odbc.max_links = -1
; Handling of LONG fields. Returns number of bytes to variables. 0 means
; passthru.
odbc.defaultlrl = 4096
; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of uodbc.defaultlrl and uodbc.defaultbinmode
odbc.defaultbinmode = 1
本人接触php不久,对配置这一块不熟悉,第一次着手用odbc连接数据库,需要其他相关资料可以及时提供,谢谢先