The Artima Developer Community
Sponsored Link

Java Answers Forum
calling a stored procedure on AS400

6 replies on 1 page. Most recent reply: Dec 7, 2005 12:17 AM by steve chu

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
steve chu

Posts: 14
Nickname: chuchutrai
Registered: Nov, 2005

calling a stored procedure on AS400 Posted: Dec 6, 2005 2:57 PM
Reply to this message Reply
Advertisement
thanks for your help everybody. so i'm able to connect to the AS400 and i want to call a stored procedure called GETLABINFO on there. i'm reading around and it's talking about SQL commands. Can somebody explain this?


steve chu

Posts: 14
Nickname: chuchutrai
Registered: Nov, 2005

Re: calling a stored procedure on AS400 Posted: Dec 6, 2005 3:13 PM
Reply to this message Reply
hmmm however i think i shouldn't be using any sql, but rather jdbc. i'm not really sure though

steve chu

Posts: 14
Nickname: chuchutrai
Registered: Nov, 2005

Re: calling a stored procedure on AS400 Posted: Dec 6, 2005 4:45 PM
Reply to this message Reply
okay so i'm connected and trying to call the procedure with this line:

CallableStatement cs = c.prepareCall( "{call QGPL/getlabinfo(?,?,?,?,?,?,?,?,?)}" );

however i'm getting a [SQL5016] error. i looked it up and it says i'm not using the QGPL/getlabinfo call correctly. i looked it up and there's two types. the collection-name/object-name and also the authorization-name.object-name form. however i'm confused by what it means by collection-name and authorization-name.

steve chu

Posts: 14
Nickname: chuchutrai
Registered: Nov, 2005

Re: calling a stored procedure on AS400 Posted: Dec 6, 2005 7:53 PM
Reply to this message Reply
fixed the above error and i was finally able to run execute but now the program just hangs and nothing happens. I'm pretty sure i have everything set up correctly. Any ideas what could be the cause of this?

steve chu

Posts: 14
Nickname: chuchutrai
Registered: Nov, 2005

Re: calling a stored procedure on AS400 Posted: Dec 6, 2005 8:37 PM
Reply to this message Reply
ah nevermind everything works now

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: calling a stored procedure on AS400 Posted: Dec 6, 2005 10:38 PM
Reply to this message Reply
Could you please post the solution?

I never used stored procedures but will do so in the near future, so this might be interesting.

Thanks

steve chu

Posts: 14
Nickname: chuchutrai
Registered: Nov, 2005

Re: calling a stored procedure on AS400 Posted: Dec 7, 2005 12:17 AM
Reply to this message Reply
this is what i came up with. assuming that the procedure getlabinfo is in the folder QGPL

try {
AS400JDBCDriver d = new AS400JDBCDriver();
AS400 o = new AS400("xxx.xxx.xxx.xxx", username, password);
Connection c = d.connect (o);

CallableStatement cs = c.prepareCall( "call
QGPL.getlabinfo(?,?,?,?,?,?,?,?,?,?)" );
cs.setString(1, Fname);
cs.registerOutParameter(2, Types.VARCHAR);
cs.registerOutParameter(3, Types.VARCHAR);
cs.registerOutParameter(4, Types.VARCHAR);
cs.registerOutParameter(5, Types.VARCHAR);
cs.registerOutParameter(6, Types.VARCHAR);
cs.registerOutParameter(7, Types.VARCHAR);
cs.registerOutParameter(8, Types.VARCHAR);
cs.registerOutParameter(9, Types.VARCHAR);
cs.registerOutParameter(10, Types.VARCHAR);
cs.execute();
}
catch(Exception) {}

Flat View: This topic has 6 replies on 1 page
Topic: need help connecting to AS400 Previous Topic   Next Topic Topic: Swing Client Database Connection

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use