php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12702 odbc_connect() and odbc_pconnect() fail
Submitted: 2001-08-11 16:30 UTC Modified: 2002-10-17 08:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ctr2sprt at yahoo dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.0.6 OS: Debian GNU/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ctr2sprt at yahoo dot com
New email:
PHP Version: OS:

 

 [2001-08-11 16:30 UTC] ctr2sprt at yahoo dot com
Using unixODBC 2.0.8-2 and php4 3:4.0.6-4 (recompiled to add unixODBC support).  unixODBC connects to a DB2 V7.1 database using DB2's provided ODBC driver.  Connection attempts fail with:

Warning: SQL error: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed, SQL state IM004 in SQLConnect

isql will connect and work correctly (even as the user wwwdata), and from my examinations of the source of PHP and isql the connection process is identical unless one of the PHP functions (like the malloc() equivalent) is failing.

If I restart Apache (and hence PHP), it works fine.  This smacks of a persistent-connections bug.  It first appeared when I was trying to fix ADODB to work with ODBC: ADODB wants to use persistent connections, but it seems as if either PHP or DB2 can't handle them.

I never knew that bringing DB2 support to Snort and ACID would be so much work!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-04 15:40 UTC] kalowsky@php.net
Please try a recent release as this behavior seems to have been resolved.  If the recent release doesn't work well... we'll have to see what else can be causing it.  :\
 [2002-02-26 10:39 UTC] kalowsky@php.net
No feedback was provided for this bug, so it is being suspended.
If you are able to provide the information that was requested,
please do so and change the status of the bug back to "Open".


 [2002-10-17 08:05 UTC] jm dot poure at freesurf dot fr
My configuration is :
- Linux RedHat 7.3
- UnixODBC-2.2.0.5
- php-4.1.2-7
- Ingres database

I am trying to connect to an Ingres database and get the very same error message from PHP. I can connect to my DSN using isql without problem.

$connect = odbc_pconnect("mydsn", "my_user", "my_password");
returns ->
Warning: SQL error: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed, SQL state IM004 in SQLConnect in /var/www/html/interepv3/test_ingres_odbc.php on line 5
 [2002-10-17 08:15 UTC] kalowsky@php.net
this sounds more like a bug in unixODBC than in PHP.  The unixODBC is failing to create a SQL_HANDLE_HENV, to which no connection can be made without.  Nothing PHP can do about this.  You may want to talk to unixODBC people about this.
 [2003-03-21 02:06 UTC] vit at uptsoft dot com
Hi All
I spent 2 days resolving this problem and the solution is so stupid.

Just add two line into /etc/rc.d/init.d/httpd :
DB2INSTANCE=db2inst1
export DB2INSTANCE

Good luck
 [2012-08-31 18:40 UTC] mlimacarlos at gmail dot com
You can change /etc/odbc.ini and config with the follow statements:

[conn]
Description= DB2 Driver
Driver = DB2 
DMEnvAttr = SQL_ATTR_UNIXODBC_ENVATTR={DB2INSTANCE=db2instl}
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 24 21:01:26 2020 UTC