Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / February 2006

Tip: Looking for answers? Try searching our database.

QMF for Windows and Updateable Views

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JC - 20 Feb 2006 18:08 GMT
I created an updateable view, which joins two tables, in a DB2 UDB
database.  The view was made updateable by the creation of an "instead
of" trigger.  I'd like to use this view for updates via QMF for Windows
or DB2 Table Editor.  However, when I try to update from either of
these tools, I receive an SQL0150 error.  Is there anything I can do to
allow the updates, such as update the READONLY value for the view in
the catalog table?  Thanks.
Knut Stolze - 20 Feb 2006 18:42 GMT
> I created an updateable view, which joins two tables, in a DB2 UDB
> database.  The view was made updateable by the creation of an "instead
> of" trigger.  I'd like to use this view for updates via QMF for Windows
> or DB2 Table Editor.  However, when I try to update from either of
> these tools, I receive an SQL0150 error.

The SQL0150 is an error code returned by DB2.  This should be unrelated to
the client you are using, i.e. QMF in your case.  I would suspect that your
instead of trigger does not work or that you do not have one.  Could you
possibly post the DDL statements for the tables, views and the triggers
along with the update or insert statements that raise the error in
question?

> Is there anything I can do to
> allow the updates, such as update the READONLY value for the view in
> the catalog table?  Thanks.

You cannot update the db2 catalog tables (views).  And that's for good
reasons.

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

JC - 20 Feb 2006 18:55 GMT
I forgot to mention above that I successfully tested the update via the
view from the DB2 CLP and the DB2 Command Center.  I've also been able
to update from QMF for a view over a single table.  The error only
occurs for the view over the two tables, when the update is attempted
in QMF.
Serge Rielau - 20 Feb 2006 19:06 GMT
> I forgot to mention above that I successfully tested the update via the
> view from the DB2 CLP and the DB2 Command Center.  I've also been able
> to update from QMF for a view over a single table.  The error only
> occurs for the view over the two tables, when the update is attempted
> in QMF.

DB2 determines the updatability of a view soley by its' structure.
E.g. a view based on a JOIN is not updatable. The rules are describe )I
think) in teh CREATE VIEW statement. Search for "updatable view"
If you need to update such a "complex" views you can take a look at
INSTEAD OF TRIGGERs. Such a trigger defines a mapping from the view to
the base table (typically the reverse operation from the SELECT).

Cheers
Serge

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

JC - 20 Feb 2006 20:43 GMT
Any idea why QMF for Windows and DB2 Table Editor both receive the
SQL0150 error on update via the view, but CLP does not?
Serge Rielau - 20 Feb 2006 22:29 GMT
> Any idea why QMF for Windows and DB2 Table Editor both receive the
> SQL0150 error on update via the view, but CLP does not?

Do these tools have an option to dump the SQLCA?
Would be interesting to see where the message originated (server or client).

Cheers
Serge
Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Knut Stolze - 21 Feb 2006 07:07 GMT
>> Any idea why QMF for Windows and DB2 Table Editor both receive the
>> SQL0150 error on update via the view, but CLP does not?
>>
> Do these tools have an option to dump the SQLCA?
> Would be interesting to see where the message originated (server or
> client).

Maybe QMF uses CLI (I strongly suspect it but don't know for sure).  This
could also be used to verify that the exact same query as on the command
line triggers the error message.

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

Knut Stolze - 21 Feb 2006 10:07 GMT
> Maybe QMF uses CLI (I strongly suspect it but don't know for sure).  This
> could also be used to verify that the exact same query as on the command
> line triggers the error message.

...by collecting a CLI trace.

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

JC - 21 Feb 2006 17:09 GMT
I took a CLI trace, but don't see any thing in the file.
Knut Stolze - 21 Feb 2006 17:26 GMT
> I took a CLI trace, but don't see any thing in the file.

You should see the SQL0150 somewhere (assuming that QMF uses only CLI and
nothing else besides it).  If not, then the error seems to originate from
another places.

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

JC - 21 Feb 2006 18:50 GMT
It must not use CLI.  I've turned on both CLI and JDBC trace
information, but there is absolutely nothing in the trace files from
QMF.  I confirmed the trace was set-up properly by using a different
application (which results in lots of trace data).
JC - 23 Feb 2006 22:20 GMT
I found there is an option to connect via CLI -- which fixed the
problem.  Thanks for your help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.