473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

HELP! reading syscat from php in db2 udb v8.1.9 Linux

I am trying to write a small app in php to make the 'COMMENT' statement
a bit more friendly, so we might do more documentation. My problem is a
set of error statements which have nothing to do with what I'm doing.
For instance when I try to run the trigger list with the code below, I
get the error message:

42832--[IBM][CLI Driver][DB2/LINUX] SQL0607N "UPDATE" is not defined for
system objects. SQLSTATE=42832

$sql = "SELECT trigname AS obj_name
FROM syscat.triggers
WHERE trigschema='$db_schema'
";
dosql($sql, "S OBJ", -1, "", $res, $n);

I get different, but similar, error messages when I try tables and views:

42808--[IBM][CLI Driver][DB2/LINUX] SQL0151N The column
"MAXFREESPACESEARCH" cannot be updated. SQLSTATE=42808

42808--[IBM][CLI Driver][DB2/LINUX] SQL0151N The column "SEQNO" cannot
be updated. SQLSTATE=42808

When I run the statements in my frontend, ADS, they all do just what I
expect. Since I don't know where the problem lies, I posted this
question to two newsgroups.
Mar 18 '06 #1
6 2910
Bob Stearns wrote:
I am trying to write a small app in php to make the 'COMMENT' statement
a bit more friendly, so we might do more documentation. My problem is a
set of error statements which have nothing to do with what I'm doing.
For instance when I try to run the trigger list with the code below, I
get the error message:

42832--[IBM][CLI Driver][DB2/LINUX] SQL0607N "UPDATE" is not defined for
system objects. SQLSTATE=42832

$sql = "SELECT trigname AS obj_name
FROM syscat.triggers
WHERE trigschema='$db_schema'
";
dosql($sql, "S OBJ", -1, "", $res, $n);

I get different, but similar, error messages when I try tables and views:

42808--[IBM][CLI Driver][DB2/LINUX] SQL0151N The column
"MAXFREESPACESEARCH" cannot be updated. SQLSTATE=42808

42808--[IBM][CLI Driver][DB2/LINUX] SQL0151N The column "SEQNO" cannot
be updated. SQLSTATE=42808

When I run the statements in my frontend, ADS, they all do just what I
expect. Since I don't know where the problem lies, I posted this
question to two newsgroups.

Appears your client attached a FOR UPDATE clause.
Try this:
SELECT trigname AS obj_name
FROM syscat.triggers
WHERE trigschema='$db_schema'
FOR READ ONLY
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Mar 19 '06 #2
Serge Rielau wrote:
Bob Stearns wrote:
I am trying to write a small app in php to make the 'COMMENT'
statement a bit more friendly, so we might do more documentation. My
problem is a set of error statements which have nothing to do with
what I'm doing. For instance when I try to run the trigger list with
the code below, I get the error message:

42832--[IBM][CLI Driver][DB2/LINUX] SQL0607N "UPDATE" is not defined
for system objects. SQLSTATE=42832

$sql = "SELECT trigname AS obj_name
FROM syscat.triggers
WHERE trigschema='$db_schema'
";
dosql($sql, "S OBJ", -1, "", $res, $n);

I get different, but similar, error messages when I try tables and views:

42808--[IBM][CLI Driver][DB2/LINUX] SQL0151N The column
"MAXFREESPACESEARCH" cannot be updated. SQLSTATE=42808

42808--[IBM][CLI Driver][DB2/LINUX] SQL0151N The column "SEQNO" cannot
be updated. SQLSTATE=42808

When I run the statements in my frontend, ADS, they all do just what I
expect. Since I don't know where the problem lies, I posted this
question to two newsgroups.


Appears your client attached a FOR UPDATE clause.
Try this:
SELECT trigname AS obj_name
FROM syscat.triggers
WHERE trigschema='$db_schema'
FOR READ ONLY

Thank you, again, for helping a learner. Does the 'FOR READ ONLY' clause
speed up things in general? Should I include whenever I am only
interested in reading the results? My php version, if it is important,
is 4.4.
Mar 19 '06 #3
Bob Stearns wrote:
Thank you, again, for helping a learner. Does the 'FOR READ ONLY' clause
speed up things in general? Should I include whenever I am only
interested in reading the results? My php version, if it is important,
is 4.4.

Unfortunately I'm not versed in PHP (yet).
What I do know is that telling what you want is always a good idea.
Some client interfaces always add FOR UPDATE clause to cursors.
Others even go as far as making cursors SCROLLABLE in utter disregard
for the impact for performance.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Mar 19 '06 #4
Serge Rielau wrote:
Bob Stearns wrote:
Thank you, again, for helping a learner. Does the 'FOR READ ONLY'
clause speed up things in general? Should I include whenever I am only
interested in reading the results? My php version, if it is important,
is 4.4.


Unfortunately I'm not versed in PHP (yet).
What I do know is that telling what you want is always a good idea.
Some client interfaces always add FOR UPDATE clause to cursors.
Others even go as far as making cursors SCROLLABLE in utter disregard
for the impact for performance.

Cheers
Serge

Would you expect this statement to return -1 rather than 1 for
odbc_num_rows? The documentation I read is singularly silent on the matter.
Mar 19 '06 #5
Bob Stearns wrote:
Serge Rielau wrote:
Bob Stearns wrote:
Thank you, again, for helping a learner. Does the 'FOR READ ONLY'
clause speed up things in general? Should I include whenever I am only
interested in reading the results? My php version, if it is important,
is 4.4.

You might want to consider moving to PHP 5.x and to deploy the IBM Zend
Core. The original unixODBC is not the best choice to communicate from PHP
to DB2.
Unfortunately I'm not versed in PHP (yet).
What I do know is that telling what you want is always a good idea.
Some client interfaces always add FOR UPDATE clause to cursors.
Others even go as far as making cursors SCROLLABLE in utter disregard
for the impact for performance.

Would you expect this statement to return -1 rather than 1 for
odbc_num_rows? The documentation I read is singularly silent on the
matter.


odbc_num_rows() does not necessarily give you reliable results. And most of
the comments in the online-PHP documentation are really bad
performance-wise as they first fetch all rows and then re-execute the
query. The general approach is to not rely on a specific number of rows
being returned but instead to process all there is and do some bookkeeping
along the way (if necessary).

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 20 '06 #6
Rather than moving to PHP 5 with Zend Core, you can just use the
ibm_db2 extension (http://php.net/ibm_db2). It is an open source
extension that is dedicated to DB2, and therefore does things right.

Zend Core just bundles it up nicely for you :)

odbc_num_rows() and db2_num_rows() depend on the underlying
SQLNumRows() implementation, which DB2 implements according to the CLI
/ ODBC standards:
* INSERT / UPDATE / DELETE return the number of rows affected by that
particular statement.
* SELECT returns -1 because no rows were affected -- unless you use a
scrollable cursor, in which case a lock does affect those rows until
you dismiss the cursor and therefore you do get a non-negative number
back.

Mar 21 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
5
by: Steve | last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp My expectation is that a developer using my DLL would be able to access this help file during his development time...
8
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.