首先通过odbcad32建立DSN:比如test,测试通过后进行下一步
<?php
$db_user="dba"; //定义连接用户名
$db_pass="sql";
$dsn="Driver={Adaptive Server Anywhere 9.0};CommLinks=SharedMemory,TCPIP{host=192.168.0.19;port=2638};EngineName=cmis30";
$conn=odbc_connect($dsn,$db_user,$db_pass);
$sql="SELECT * FROM \"DBA\".\"o_userpassword\"";
$rs = odbc_exec($conn,$sql);
odbc_fetch_row($rs);
while (odbc_fetch_row($rs))
{
$result = odbc_result($rs,"loginname");
echo "<tr><td>$result</td><br></tr>";
}
odbc_close($conn);
?>