One can run command via JDBC without a stored procedure if passing parameters is not needed. For example:

String cmd = "CALL QSYS.QCMDEXC ('DSPPTF OUTPUT(*OUTFILE) OUTFILE(QTEMP/DMYFILE)',0000000046.00000)";

CallableStatement cs = connection.prepareCall(cmd);

cs.execute();

Coy Krill wrote:

Here is the SQL code you can execute either via JDBC or directly on the
iseries. I've never tried calling QCMDEXC  and was definitely under the
impression that a wrapper such as this is necessary. I believe this is close
to nearly identical to something published in one of the iSeries reference
manuals or a redbook. Change WIBRUN to be whatever library you want to
create the stored procedure in.

-- Allows Execution of CL Commands from SQL
CREATE PROCEDURE WIBRUN.CMDEXC(CMD CHAR(32000), LEN DECIMAL(15, 5))
LANGUAGE CL
NOT DETERMINISTIC
NO SQL
EXTERNAL NAME QSYS.QCMDEXC
PARAMETER STYLE GENERAL;


Coy Krill
Systems Analyst
Whidbey Island Bank -----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Anand, Rajesh
Sent: Monday, January 09, 2006 00:32
To: Java Programming on and around the iSeries / AS400
Subject: RE: QZDASOINIT Jobs
Paul,

        This is very interesting, how would I go about adding JDBC stored
procedure??

        Can you list the steps involved or link to some detailed info??

        Many Thanks,

Rajesh Anand
Email:Rajesh_anand@xxxxxx


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Holm
Sent: 06 January 2006 18:47
To: java400-l@xxxxxxxxxxxx
Subject: Re: QZDASOINIT Jobs



You should also be able to use something like this as the JDBC stored
procedure call:

CALL QSYS.QCMDEXEC('SNDPGMMSG("Pgm x calling")', 0000000026.00000)

Where 26 is the length of the command.
This may provide benefits:
*  Ability to pass ANY cl command to the JDBC SQL connection such as
OVRDBF,etc
*  Create a little utility that takes a command and builds the call qcmdexec
SP call string generically
*  Doesn't require a special CL for each command


If had this on my list of things to try.  I don't see why it would not work.


HTH - Paul Holm

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.14/222 - Release Date:
1/5/2006
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain
or redistribute it. Click here for important additional terms relating to
this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.

************************************************************************
The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this e-mail by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. ***********************************************************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.