Ubuntu 10.04 zend-server 和 informix 连接

发布于 2024-10-02 08:00:12 字数 1135 浏览 8 评论 0原文

我有一个问题,要获取连接到 Informix DB 的 PHP 脚本。我想安装 Zend-server 社区版以及 pdo_informix 扩展。当我在浏览器中运行 Zend-server 管理时,我看到 pdo_informix 扩展标记为“绿色”。之后我在 Ubuntu 上安装了 Informix ClientSDK 3.70。我已将 $INFORMIXDIR 环境变量设置到 /etc/profile 和 bin 目录的 PATH 变量中。安装目录是 /opt/IBM/informix 。当我现在尝试用 PHP 编写代码时,

try{

 $db = new PDO("informix:host=xx.xx.com;database=xxx;server=xxx_net; protocol=onsoctcp;", databaseuser, databasepassword);
 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 echo "test";

}catch (PDOException $e){

 echo "<br/>Failed: ". $e->getMessage()."<br/>";
}

我在浏览器中遇到以下错误:

Failed: SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix]
   [Informix ODBC Driver][Informix]Unspecified System Error = -23101.

如果我尝试将 Ubuntu 上的 Server Studio 连接到 Informix DB,它运行良好,但我猜他们正在使用 JDBC司机。

如果我进入 Informix clientdk 的 bin 目录,会发现有一个名为 finderr 的应用程序。如果我执行 finderr -23101 ,我会得到以下输出:

./finderr -23101
-23101 Unable to load locale categories.

所以我认为我必须设置 DB_LOCALE、CLIENT_LOCALE 环境变量...我的服务器正在使用 en_us.819 而我的客户端正在使用 en_us.utf8 。

I have the issue, to get a PHP script connecting to an Informix DB. I thought installing the Zend-server community edition and in addition the pdo_informix extension. When I run the Zend-server admin in the browser, I see the pdo_informix extension marked as "green". Afterwards I've installed the Informix ClientSDK 3.70 on Ubuntu. I've set the $INFORMIXDIR environment variable into /etc/profile and into the PATH variable to the bin directory. The installation dir was /opt/IBM/informix . When I now try to write code in PHP like

try{

 $db = new PDO("informix:host=xx.xx.com;database=xxx;server=xxx_net; protocol=onsoctcp;", databaseuser, databasepassword);
 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 echo "test";

}catch (PDOException $e){

 echo "<br/>Failed: ". $e->getMessage()."<br/>";
}

I've got the following error in the browser:

Failed: SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix]
   [Informix ODBC Driver][Informix]Unspecified System Error = -23101.

If I'm trying to connect with the Server Studio on Ubuntu to the Informix DB it works well, but I guess they are using the JDBC driver.

If I go to the bin directory of my Informix clientsdk, there is an application called finderr. If I do a finderr -23101 I get the following output:

./finderr -23101
-23101 Unable to load locale categories.

So i thought that I have to set the DB_LOCALE, CLIENT_LOCALE environment variables... my server is using en_us.819 and my client is using en_us.utf8 .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不回头走下去 2024-10-09 08:00:12

无法加载语言环境类别通常意味着未为尝试访问 Informix 语言环境数据(可在 $INFORMIXDIR/gls 中找到)的软件设置 INFORMIXDIR,或者语言环境类别未指定或指定错误。这些通常是环境变量 CLIENT_LOCALE 和 DB_LOCALE,其值包括“en_us.8859-1”(默认值)或“es_es.u​​tf8”(西班牙西班牙语,使用 UTF-8)。

我会集中精力确保浏览器的环境设置正确。这可能取决于您启动它的方式。

还有一些其他可以使用的环境变量 - DBLANG、LANG 和 LC_* 名称集。但是,如果设置了 CLIENT_LOCALE 和 DB_LOCALE,则不太可能需要它们。尽管如此,我最近发现,在 Informix 4GL (I4GL) 中,除非设置了 DBLANG 以及 *LOCALE 变量,否则一些用日文字符编写的代码(例如表名)将无法编译。然而,LC* 和 LANG 变量似乎对结果影响很小甚至没有影响。

Being unable to load locale categories normally means that either INFORMIXDIR is not set for the software trying to access the Informix locale data (which is found in $INFORMIXDIR/gls), or that the locale categories are unspecified or mis-specified. These are classically the environment variables CLIENT_LOCALE and DB_LOCALE, which have values such as 'en_us.8859-1' (the default) or 'es_es.utf8' (Spanish in Spain using UTF-8).

I would concentrate on ensuring that the browser has the environment set correctly. It may depend on how you launch it.

There are some other environment variables that could be used - DBLANG, LANG, and the LC_* set of names. However, they are unlikely to be needed if CLIENT_LOCALE and DB_LOCALE are set. With that said, I've recently found that with Informix 4GL (I4GL), some code written with Japanese characters in things like table names would not compile unless DBLANG was set as well as the *LOCALE variables. However, the LC* and LANG variables seemed to have minimal to no effect on the result.

慵挽 2024-10-09 08:00:12

您可能必须设置LD_LIBRARY_PATH。我这样做的是:

export LD_LIBRARY_PATH=$INFORMIXDIR/lib/:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:
export PATH=$INFORMIXDIR/bin:$INFORMIXDIR/lib:/usr/local/bin:/usr/bin:/bin

如果这没有帮助,那么你可以尝试使用 unixODBC。 PHP 似乎使用某种 ODBC。在 unixODBC 在线手册中,有一篇关于连接到 Informix 的文章 - 请阅读它。使用isql(交互式 SQL)unixODBC 工具连接到配置的 ODBC 数据库。

如果 isql 无法连接到数据库并出现相同的错误,那么您可以使用 strace 查看 ODBC 驱动程序无法加载哪个库。

You probably have to set LD_LIBRARY_PATH. I do it with:

export LD_LIBRARY_PATH=$INFORMIXDIR/lib/:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:
export PATH=$INFORMIXDIR/bin:$INFORMIXDIR/lib:/usr/local/bin:/usr/bin:/bin

If that will not help then you can try with unixODBC. It seems that PHP uses some kind of ODBC. In unixODBC online manuals there is article about connecting to Informix - read it. Use isql (interactive SQL) unixODBC tool to connect to configured ODBC database.

If isql cannot connect to database with the same error then you can use strace to see what library the ODBC driver cannot load.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文