#18594 [Opn->Csd]: DB2 Queries return zero rows
| From: | kalowsky@php.net | Date: | Wed, 31 Jul 2002 04:22:24 +0000 |
| Subject: | #18594 [Opn->Csd]: DB2 Queries return zero rows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-15638@lists.php.net to get a copy of this message | ||
ID: 18594
Updated by: kalowsky@php.net
Reported By: eableson@mac.com
-Status: Open
+Status: Closed
Bug Type: ODBC related
Operating System: Windows NT 4.0/W2K
PHP Version: 4.2.2
New Comment:
Is the bug you're trying to state that odbc_num_rows returned a value
of 0?
If this is the case, please read the documentation for odbc_num_rows.
On a select the ODBC driver will return (typically) a false as per the
ODBCv2 standard.
I suggest you try iterating through the result of your query and seeing
if the data exists.
Marking this as closed as this is a clearly documented issue.
Previous Comments:
------------------------------------------------------------------------
[2002-07-26 11:20:43] eableson@mac.com
My script is making an ODBC connection to a remote DB2 database (I
think the host is an AS400). The data expected was the 34 row result
noted below, but it reports zero rows returned. The ODBC connection
setup is good as I have been able to receive the 34 row result into
Excel. Further testing of queries that should force a single row
result (SELECT COUNT(*) FROM RU99.RC545 WHERE SIGNONID='L6XJ') also
returns zero rows.
Authentication is working correctly, and error handling is working
correctly - validated by trying with bad credentials and an invalid SQL
statement. It appears that the query is being issued properly since
the page load time is directly related to the complexity of the query
issued.
Any help would be appreciated,
Erik Ableson
$dbconn = odbc_connect ( "DSN", "USER", "PASSWORD");
echo "Connected to: '$dbconn'<br>";
$sqlresult = odbc_exec( $dbconn, "SELECT * FROM RU99.RC548 WHERE
SIGNONID='L6XJ'");
echo "SQL Result: '" . $sqlresult . "'<BR>\n";
echo "Fields returned: " . odbc_num_fields($sqlresult) . "<BR>\n";
echo "Rows returned: " . odbc_num_rows ($sqlresult) . "<BR>\n";
With the following results:
Connected to: 'Resource id #1'
SQL Result: 'Resource id #2'
Fields returned: 6
Rows returned: 0
Actual output from DB2 client software:
SIGNONID NEW_VALUE
ATTR_NM
--------
--------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------
L6XJ L6XJ
userid
L6XJ 271941
unixid
L6XJ 84
unitnum
L6XJ ASSOCIATE
title
L6XJ 309-763-9022
telephonenumber
L6XJ Ableson
sn
L6XJ 20030710
reviewdate
L6XJ 20021008
reviewdate
L6XJ 30
recordtype
L6XJ 00
officenum
L6XJ OPR00A
ntdomain
L6XJ 001
notesserver
L6XJ TRUE
notesaccount
L6XJ MIKE WEER
managername
L6XJ AXM4
managerid
L6XJ Erik.Ableson.L6XJ@StateFarm.com
mail
L6XJ 100
locationnum
L6XJ CORPORATE SOUTH K2
location
L6XJ EXCH0001
hpnode
L6XJ Erik
givenname
L6XJ TRUE
exchangemail
L6XJ Associate
employeetype
L6XJ Erik.ABLESON
emc2name
L6XJ 00
dpoffice
L6XJ 9
divisionnum
L6XJ 99999
deptcat
L6XJ SYSTEMS
departmenttitle
L6XJ 1-00-984-100
departmentnumber
L6XJ 0
countrycode
L6XJ 1
companynum
L6XJ PSINET CONSULTING SOLUTIONS
companyname
L6XJ Erik Ableson
cn
L6XJ OPR95A
altntdomain
L6XJ DEV00A
altntdomain
34 record(s) selected.
db2 =>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18594&edit=1