duanrang9348 2014-01-24 16:34
浏览 126
已采纳

将PHP连接到UniVerse ODBC DSN

I have what seems a simple question, but I just cant get php to connect to my ODBC DSN.

I have a webserver with an ODBC DSN configured properly, I can test the connection and it works just fine.

I am now trying to connect PHP to this DSN.

MYDSNNAME is using the driver: UniVerse 64-Bit ODBC Driver.

Here is my php code:

$conn=odbc_connect('MYDSNNAME','username','password',SQL_CUR_USE_ODBC);

if (!$conn)
{
    exit("Connection Failed: " . $conn);
}

$sql="SELECT * FROM customers";
$rs=odbc_exec($conn,$sql);

if (!$rs)
{
    exit("Error in SQL");
}

dbc_close($conn);

I am getting the following error:

Message: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect

I have tried using the 64bit ODBC administrator and that did not work. Any suggestions would be great.

Thanks

  • 写回答

1条回答 默认 最新

  • donglu9898 2014-02-11 18:55
    关注

    I was able to circumvent the error I was getting by using the 32bit version of the driver within my ODBC Administrator and I am now connecting just fine.

    It gets a little tricky with 32/64bit versions of the odbc administrator.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题