|
This is off the top of my head, so hopefully the syntax would be
correct!
Hopefully this formats OK,
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class TestProgramCallJDBC
{
public static void main(String[] args)
{
Connection con = null;
Statement stmt = null;
try
{
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
con =
DriverManager.getConnection("jdbc:as400://mysystem/mylibrary",
"myuser", "mypassword");
stmt = con.createStatement();
stmt.executeUpdate("CALL
MYPGM('parm1','parm2','parm3'");
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if (stmt != null)
{
try
{
stmt.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
if (con != null)
{
try
{
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
}
Just substitute how you get the connection, and the program you want to
call. Hopefully this helps.
Tim
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Eyers, Daniel
Sent: Tuesday, March 18, 2003 9:42 AM
To: 'Java Programming on and around the iSeries / AS400'
Subject: RE: how to submit a job on iSeries from webapplication
Can you provide details here? I looks interesting but I'm unsure of the
syntax...
perhaps a code snippet would help...
thanks
dan
-----Original Message-----
From: Tim Kosacek [mailto:tkosacek@xxxxxxxxxxxxxx]
Sent: Tuesday, March 18, 2003 7:19 AM
To: 'Java Programming on and around the iSeries / AS400'
Subject: RE: how to submit a job on iSeries from webapplication
You might want to do this using JDBC. This will allow you to make a
synchronous call to a program. You can call executeUpdate on a
Statement or PreparedStatement and pass a String with the syntax of
"CALL MYPGM('parm1','parm2','parm3')" Of course, you will need to make
sure the program can be resolved in the library list if you don't
specify a library/program. You can however make successive calls on the
same connection object and it will use the same server job and library
list.
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of
P.Goovaerts@xxxxxxxxxx
Sent: Tuesday, March 18, 2003 4:50 AM
To: web400@xxxxxxxxxxxx
Cc: java400-l@xxxxxxxxxxxx
Subject: how to submit a job on iSeries from webapplication
Hi,
We have a webapp running which we want to extend with a command to run a
program on the iSeries.
The webapp runs with html/jsp/servlets and we want to add a button on a
jsp which, when pressed, SUBMIT's a program on the iSeries.
I know we can use a 'Distributed Program Call', but this call will run
'interactive'
And yes, this DPC can call a CL which will submit the job
But is there a 'better' way?
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.