473,395 Members | 1,653 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.

DB2 Java stored procedure call

Hi, is there any way to call a JAVA stored procedure from a SQL Trigger?
We are having difficulties with this and cannot verify whether DB2 even
*has* this capability?

Thank you very much....
Aug 30 '06 #1
4 4972
Pakna wrote:
Hi, is there any way to call a JAVA stored procedure from a SQL Trigger?
We are having difficulties with this and cannot verify whether DB2 even
*has* this capability?

Thank you very much....
CALL in trigger is supported with DB2 V8.2 (V8.1 FP7) for LUW.
What sort of error do you get?
If you call a procedure from a BEFORE trigger make sure the proc is
defined as READS SQL DATA.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 30 '06 #2
Serge Rielau wrote:
Pakna wrote:
>Hi, is there any way to call a JAVA stored procedure from a SQL
Trigger? We are having difficulties with this and cannot verify
whether DB2 even *has* this capability?

Thank you very much....
CALL in trigger is supported with DB2 V8.2 (V8.1 FP7) for LUW.
What sort of error do you get?
If you call a procedure from a BEFORE trigger make sure the proc is
defined as READS SQL DATA.

Cheers
Serge
Serge Rielau wrote:
Pakna wrote:
>Hi, is there any way to call a JAVA stored procedure from a SQL
Trigger? We are having difficulties with this and cannot verify
whether DB2 even *has* this capability?

Thank you very much....
CALL in trigger is supported with DB2 V8.2 (V8.1 FP7) for LUW.
What sort of error do you get?
If you call a procedure from a BEFORE trigger make sure the proc is
defined as READS SQL DATA.

Cheers
Serge
OK, here's the deal...we have a Java stored procedure which takes six
parameteres, two of these are input parameters (the first two in the
parameter brackets, both integer) and the other four are output
parameters (integer, sqlstate varchar, sqlcode integer and sqlmessage
varchar).

Now, the we've eventually narrowed down the problem to output parameter
definition - the best we could come up with is those four NULLS that can
be observed at the end of the brackets.

The catch is this - we cannot figure out how to explicitly define output
parameters (nor can I personally understand why is there a need to even
do so).

So the question is - how to define those pesky output parameters (we've
tried to omit them, it won't do).

******BEGIN TRIGGER SEGMENT*************

CREATE TRIGGER DB2CROSS.AIR_triger_proba
AFTER
INSERT
ON DB2CROSS.proba
REFERENCING
NEW AS N
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
CALL DB2CROSS.INS_DOST_LIST_CLAN (2, 10, null, null, null, null);
END;

*********ERROR SEGMENT***********

DB21034E The command was processed as an SQL statement because it was not a

valid Command Line Processor command. During SQL processing it returned:

SQL0469N The parameter mode (IN, OUT, or INOUT) is not valid for a
parameter

in procedure "INS_DOST_LIST_CLAN" with specific name "SQL060713101412210"

(parameter number "2", name "P_USPJEH"). LINE NUMBER=1. SQLSTATE=42886

***********END ERROR SEGMENT****************
Aug 30 '06 #3
--#SET TERMINATOR @
CREATE TRIGGER DB2CROSS.AIR_triger_proba
AFTER
INSERT
ON DB2CROSS.proba
REFERENCING
NEW AS N
FOR EACH ROW
BEGIN ATOMIC
DECLARE mysqlcode INTEGER;
DECLARE mysqlstate CHAR(5);
DECLARE myMsg VARCHAR(70);
CALL DB2CROSS.INS_DOST_LIST_CLAN (2, 10, mysqlcode, mysqlstate,
mymsg);
END
@

All languages I ever worked with will complain if you try to assign a
value to a value, so out parameters require out which are variable.
No expressions, no constants allowed.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 30 '06 #4
Serge Rielau wrote:
--#SET TERMINATOR @
CREATE TRIGGER DB2CROSS.AIR_triger_proba
AFTER
INSERT
ON DB2CROSS.proba
REFERENCING
NEW AS N
FOR EACH ROW
BEGIN ATOMIC
DECLARE mysqlcode INTEGER;
DECLARE mysqlstate CHAR(5);
DECLARE myMsg VARCHAR(70);
CALL DB2CROSS.INS_DOST_LIST_CLAN (2, 10, mysqlcode, mysqlstate,
mymsg);
END
@

All languages I ever worked with will complain if you try to assign a
value to a value, so out parameters require out which are variable.
No expressions, no constants allowed.

Cheers
Serge
Thank you very much, it did work, though we didn't need the terminator.
Where did you notice we were trying to assign a value to value, we
didn't notice that?
Sep 1 '06 #5

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

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
7
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install...
0
by: Rhino | last post by:
I've written several Java stored procedures now (DB2 V7.2) and I'd like to write down a few "best practices" for reference so that I will have them handy for future development. Would the...
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
1
by: Uma | last post by:
DB2I.PROCEDURE1 - Build started. C:\SQLLIB\java\jdk\bin\javac -classpath ".;C:\SQLLIB\java\db2java.zip;C:\SQLLIB\java\runtime.zip;C:\SQLLIB\java\sqlj.zip" "PROCEDURE1.java" DB2I.PROCEDURE1 -...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
1
by: amgupta8 | last post by:
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2. Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.