[英]PHP warning odbc_connect() SQL Error
I just installed an iSeriesODBC-5.1.0-0.16.i386.rpm on my ubuntu linux 12.04 32bit OS. 我刚刚在ubuntu Linux 12.04 32位OS上安装了iSeriesODBC-5.1.0-0.16.i386.rpm。 What im trying to do is connect to a DB2 AS400. 我试图做的是连接到DB2 AS400。
When I run this code below: 当我在下面运行此代码时:
<?php
$JDALIB = 'MMMMMM';
$DSN = "DRIVER=iSeries Access ODBC Driver;SYSTEM=dev_ip;DBQ=$JDALIB";
$connect = odbc_connect($DSN, "USERNAME", "PASSWORD", SQL_CUR_USE_IF_NEEDED);
gave me an 给了我一个
PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/odbc_connection.php on line 6
So what i did was to install unixODBC and freeTDS and I did install them successfully but when I run again my connection script. 因此,我要做的是安装unixODBC和freeTDS,并成功安装了它们,但是当我再次运行连接脚本时。 Still same error result. 仍然是相同的错误结果。 Can anyone help me. 谁能帮我。
Not sure why you would install freeTDS, thats to connect to SQL Server or Sybase. 不知道为什么要安装freeTDS,那就是要连接到SQL Server或Sybase。
Also, not sure where DBQ is from, that looks more like a MS Access connection attribute. 同样,不确定DBQ来自何处,它看起来更像是MS Access连接属性。
You could try 你可以试试
$DSN = "DRIVER={iSeries Access ODBC Driver};HOSTNAME=dev_ip;Database=$JDALIB"; $ DSN =“ DRIVER = {iSeries Access ODBC驱动程序}; HOSTNAME = dev_ip;数据库= $ JDALIB”;
But I would try and get it working with isql first, there are docs on the unixODBC site that describe getting DB2 connections working. 但是我会尝试使其首先与isql一起使用,unixODBC站点上有一些文档描述了如何使DB2连接正常工作。
I would try to create a DSN and get that working before trying to use a DSN less connection as you are doing. 我会尝试创建一个DSN并使其正常工作,然后再尝试使用较少的DSN连接。
Have a read of http://www.unixodbc.org/doc/db2.html 阅读http://www.unixodbc.org/doc/db2.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.