简体   繁体   English

PHP警告odbc_connect()SQL错误

[英]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.

相关问题 的php:odbc_connect():SQL错误 - php: odbc_connect(): SQL error PHP-odbc_connect()-SQL错误 - PHP - odbc_connect() - SQL error 错误:使用PHP的odbc_connect - Error : odbc_connect with php PHP警告:odbc_connect():SQL错误:[Microsoft] [ODBC Microsoft Access驱动程序]常规错误无法打开注册表项临时(volatile) - PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) PHP Wordpress odbc_connect():“错误:调用未定义的 function odbc_connect()” - PHP Wordpress odbc_connect() : "Error: Call to undefined function odbc_connect()" odbc_connect sql服务器 - odbc_connect sql server php odbc_connect()连接 - php odbc_connect() connection 警告:odbc_connect():SQL 错误:[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序 - Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified PHP 警告:odbc_connect():SQL 错误:[unixODBC][Driver Manager]无法打开 lib。 在 php 中连接到 Snowflake 不起作用,但 isql 连接是 - PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib. Connection to Snowflake in php is not working but isql connection is 使用odbc_connect与MS SQL进行PHP连接 - PHP connectivity with MS SQL using odbc_connect
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM