If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > calling stored procedure in trigger???

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-03-04, 10:39
shedb shedb is offline
Registered User
 
Join Date: Dec 2003
Posts: 78
calling stored procedure in trigger???

hello,
we have a stored procedure in a database SAMPLE,
we created a stored procedure called procx:
(i've pasted the code below).
we want to create a trigger that calls the stored procedure after an insert:
that is the sql of the trigger:

CREATE TRIGGER DRADUSR0.TRIAL AFTER INSERT ON DRADUSR0.DENEME FOR EACH ROW MODE DB2SQL CALL PROCX();

when we try to crate it; it gives the error below:

"[IBM][CLI Driver][DB2/6000] SQL0104N An unexpected token "(" was found following "DE DB2SQL CALL PROCX". Expected tokens may include: "JOIN <joined_table>". LINE NUMBER=1. SQLSTATE=42601"

what can we do??? what is wrong???
thank u all





/**
* JDBC Stored Procedure DRADUSR0.ProcX
*/
import java.sql.*; // JDBC classes
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

public class ProcX
{
public static void procX ( ResultSet[] rs ) throws SQLException, Exception
{
// Get connection to the database
Connection con = DriverManager.getConnection("jdbc:default:connecti on");
PreparedStatement stmt = null;
String sql;

System.out.println("Start Servlet");
URL servletURL = new URL("http://127.0.0.1/AKBANKBranchProjectWEB/servlet/com.akbank.server.test.stress.StressServlet");
try {
URLConnection servletConnection= servletURL.openConnection();


/* DO POST OLMASI ICIN BU KISIM ACIK
* DO GET ICIN KAPALI OLMASI GEREKIYOR.
* BEGIN
* */

servletConnection.setDoOutput(true);
ByteArrayOutputStream byteSteam = new ByteArrayOutputStream(512);
PrintWriter out = new PrintWriter(byteSteam,true);
String postData= "firstName=3&lastName=7";
out.print(postData);
out.flush();
servletConnection.setRequestProperty("Content-Length",String.valueOf(byteSteam.size()));
byteSteam.writeTo(servletConnection.getOutputStrea m());

/* END
* */

BufferedReader in = new BufferedReader(new InputStreamReader(servletConnection.getInputStream ()));
String line ;
while ((line= in.readLine())!=null) {
System.out.println(line);
System.out.println("");
}

} catch (IOException e) {
System.out.println(e.toString());
}
System.out.println("End Servlet");


if (con != null) con.close();
}
}
Reply With Quote
  #2 (permalink)  
Old 06-03-04, 10:45
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Calling stored procs from trigger is proposed to be supported only from Version 8.2 (aka Stinger) ...

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On