function conn($hostName,$Login,$Password,$dbName,$Port) //建立目标数据库连接{ $conn = &ADONewConnection('postgres8'); $conn->debug = false; //true时adodb将在页面显示debug信息 $conn->LogSQL(false); //true时adodb将建立adodb_sqllog表记录每次sql操作 $conn->Connect($hostName,$Login,$Password,$dbName,$Port); //$conn->Connect("localhost","olebarowner","olebar",'hn_db'); $conn->SetFetchMode(ADODB_FETCH_ASSOC); return $conn;}
PHP连接PGSql的方法