php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45598 Unable to query remote cataloged odbc
Submitted: 2008-07-22 20:12 UTC Modified: 2020-10-18 04:22 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: phil dot nyc at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: ODBC related
PHP Version: 5.3CVS-2008-07-22 (snap) OS: Aix 5.3 64-bit
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-07-22 20:12 UTC] phil dot nyc at gmail dot com
Description:
------------
on Aix 5.3 64-bit, have db2 connect installed to connect to iSeries db2, and local aix db2.

able to do so using the db2 command line client, but using php only able to query local aix db2.

using php, able to connect to remote (iSeries) db2 but not able to execute query!


Reproduce code:
---------------
http://pastebin.com/f462c54ee

Expected result:
----------------
resource(5) of type (odbc link persistent)
select count(*) from dkactivity
resource(6) of type (odbc result)
int(4)
string(4) "4473"
===
resource(8) of type (odbc link persistent)
select count(*) from dfkdta10.bnncli with nc
resource(9) of type (odbc result)
int(4)
string(4) "3570"


Actual result:
--------------
resource(5) of type (odbc link persistent)
select count(*) from dkactivity
resource(6) of type (odbc result)
int(4)
string(4) "4473"
===
resource(8) of type (odbc link persistent)
select count(*) from dfkdta10.bnncli with nc
resource(9) of type (odbc result)

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 544696693 bytes) in /usr/dfkp/webscripts/test/db2.php on line 11


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-22 20:13 UTC] phil dot nyc at gmail dot com
I would like to follow up with a more detailed report that I've been able to collect after spinning in circles on this problem for the last couple of days (have gone through various versions of php5 and php4 and compilers, and this is as close as I get)

=========
SYSTEM SPECS
=========

uname -a
AIX unnamed12a 3 5 000AD01ED700

CC=xlc_r  ./configure --enable-cli --with-ibm-db2=/db2/v91p/db2lawp/sqllib --enable-pcntl 1>1 2>2

make

root@unnamed12a: /usr/src/php5.3-200807211430>sapi/cli/php -v
PHP 5.3.0-dev (cli) (built: Jul 22 2008 15:42:32)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies

=========
TEST SCRIPT
=========

<?php

function q($db, $sql)
	{
	print "$sql\n";

	$a = odbc_exec($db, $sql);

	var_dump($a);

	var_dump(strlen(odbc_result($a, 1)));
	if(strlen(odbc_result($a, 1)) < 1000000)
		var_dump(odbc_result($a, 1));
	else
		print "too big\n";
	}

function local()
	{
	$db2 = odbc_pconnect('prod81','db2lawp','password');
	var_dump($db2);
	q($db2, 'select count(*) from dkactivity');
	odbc_close($db2);
	}

function remote()
	{
	$db2 = odbc_pconnect('dfk01','db2user','password');
	var_dump($db2);
	q($db2, 'select count(*) from dfkdta10.bnncli');
	odbc_close($db2);
	}

print "===\n";local();
print "===\n";remote();

?>


=====
OUTPUT
=====

root@unnamed12a: /usr/src/php5.3-200807211430/sapi/cli>./php -f /usr/dfkp/webscripts/test/db2.php
===
resource(5) of type (odbc link persistent)
select count(*) from dkactivity
resource(6) of type (odbc result)
int(4)
string(4) "4473"
===
resource(8) of type (odbc link persistent)
select count(*) from dfkdta10.bnncli with nc
resource(9) of type (odbc result)

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 544696693 bytes) in /usr/dfkp/webscripts/test/db2.php on line 11

==========================================
CONFIRM REMOTE DB2 DOES INDEED WORK
==========================================

$ uname -a
AIX unnamed12a 3 5 000AD01ED700
$ who am i
db2lawp     pts/1       Jul 22 15:57     (toshiba200601) 
$ db2 connect to prod81

   Database Connection Information

 Database server        = DB2/AIX64 9.1.0
 SQL authorization ID   = DB2LAWP
 Local database alias   = PROD81

$ db2 "select count(*) from dkactivity"

1          
-----------
       4473

  1 record(s) selected.

$ db2 terminate
DB20000I  The TERMINATE command completed successfully.
$ db2 connect to dfk01 user db2user
Enter current password for db2user: 

   Database Connection Information

 Database server        = OS/400 5.4.0
 SQL authorization ID   = DB2USER
 Local database alias   = DFK01

$ db2 "select count(*) from dfkdta10.bnncli"

00001      
-----------
       3570

  1 record(s) selected.

$ db2 terminate
DB20000I  The TERMINATE command completed successfully.
$
 [2020-10-05 07:59 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-05 07:59 UTC] cmb@php.net
If you still can reproduce this with any of the actively supported
PHP versions[1], please update the PHP version info, provide a
minimal reproduce script and an ODBC trace of running that script.

[1] <https://www.php.net/supported-versions.php>
 [2020-10-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 18:01:23 2020 UTC