Define cursor

General discussion on Zend Core for IBM System i
Post Reply
Posts: 1
Joined: Wed Apr 13, 2011 10:04 am

Define cursor

Post by neckrom » Wed Apr 13, 2011 10:29 am

I'm new to zend core i5/os, and not very expirenced on IBM iservers, so excuse me if I'm asking a stupid question.

I've PHP installed on our V5R4 server. I'm trying to make a simple query that despite being executed with 'STRSQL' on the OS side, it doesn't on PHP side.

So the query is:

Code: Select all

SELECT table2.key, FROM table1 LEFT OUTER JOIN table2 ON (table1.key = table2.key) WHERE table1.year = '2011' AND table1.weeknr = '15' GROUP BY table2.key,
Doing this on the OS side via STRSQL gets executed, but in PHP it returns me an error that I don't know how to get arround:

Code: Select all

Error: Array | Error Message: 36001 | Error number: -243
The connection I've made to connect to the server is as follows:

Code: Select all

$i5_server_ip = "";
$i5_uname = "username";
$i5_pass = "password";
$i5_database = "DATABASE";
$options = array(
		I5_OPTIONS_JOBNAME      => null, 
		I5_OPTIONS_INITLIBL     => $i5_database);
/*$db2options = array(
			'cursor' => DB2_SCROLLABLE
$conn = i5_connect($i5_server_ip, $i5_uname, $i5_pass, $options);
if ($conn === false) {
	echo "APPLICATION PANIC: Failed to connect to server!!!<br/>";
	die("Error: ".i5_error()." | Error Message: ".i5_errormsg()." | Error number:".i5_errno());
The error is thrown on the following PHP code:

Code: Select all

$result=i5_query($query_string) or die ("Error: ".i5_error()." | Error Message: ".i5_errormsg()." | Error number: ".i5_errno());
Can anyone help?
Thanks in advance!

Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Define cursor

Post by scottgcampbell » Wed Apr 13, 2011 2:35 pm

If you are just getting started you will probably want to switch to ZendServer now,, the CE version is also free.
If you have a lot done you will probably still want to switch but maybe not immediately.

You will probably also want to use the db2* functions instead of the i5* functions.

For example:

Code: Select all

$condb2 = db2_pconnect ( 'databasename', '', '');
$query_res = db2_prepare ( $condb2, $sql, array() ) ;
if (! $query_res)
	echo ( db2_stmt_error() . " - Query: Prepare error:" . db2_stmt_errormsg ()) ;
	return false ;
$qry_err = db2_execute ( $query_res, array() ) ;
if (! $qry_err)
	$error = true ;
	echo ( "Query: execute error : " . db2_stmt_error () ) ;
echo "<pre>";
while ( ($row = db2_fetch_array ( $query_res )) )
	print_r( $row ) ;
echo "</pre>Done";
Hope that helps.


Posts: 393
Joined: Tue Jul 07, 2009 9:01 am

Re: Define cursor

Post by erich_hieden » Wed Apr 13, 2011 3:24 pm

According to System i Database SQL messages and codes
Message Text:
SENSITIVE cursor &1 cannot be defined for the specified SELECT statement.
Cause Text:
The cursor &1 is defined as SENSITIVE but the query requires the creation of a temporary result table. A SENSITIVE cursor cannot be implemented.
Recovery Text:
Redefine the cursor as ASENSITIVE or INSENSITIVE or change the query so that it no longer requires the creation of a temporary result table.
Can't tell you anything else about that, since I've never been coming across this error.


Post Reply