Re: is there anyone who has some idea? i am trying to call Stored procedure using JDBC
From: Jan M. Nelken (Unknown.User_at_Invalid.Domain)
Date: 02/19/05
- Previous message: Rico: "Re: Hibernate and log4j config under Tomcat."
- Next in thread: Lee Fesperman: "Re: is there anyone who has some idea? i am trying to call Stored procedure using JDBC"
- Reply: Lee Fesperman: "Re: is there anyone who has some idea? i am trying to call Stored procedure using JDBC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 18 Feb 2005 19:15:51 -0500
Kelly wrote:
> I am trying to use jdbc to call sp procedure in UDB 8.1, the following
> is the jdbc code.
> ------------------------------------------------------------------------------------------
> con = getConnection();
> cstmt = con.prepareCall("call db2admin.cj_sp_auth(?,?,?,?,?)");
> cstmt.setString(1, userName);
> cstmt.registerOutParameter(2, Types.VARCHAR);
> cstmt.registerOutParameter(3, Types.INTEGER);
> cstmt.registerOutParameter(4, Types.CHAR);
> cstmt.registerOutParameter(5, Types.INTEGER);
>
> // Execute the stored procedure call.
> cstmt.execute();
> ------------------------------------------------------------------------------------------
1. You posted this question twice. Once would do better.
2. Your Stored Procedure has a little problem: it works when Username is found,
however it does not work very well when Username does not exist for example.
You may want to test it from command line first; for example:
D:\Temp>db2 call cj_sp_auth('WrongName',?,?,?,?)
Value of output parameters
--------------------------
Parameter Name : O_PASSWORD
Parameter Value :
Parameter Name : GRDBSTA
Parameter Value : 1
Parameter Name : V_MESSAGE
Parameter Value :
Parameter Name : GRDBDES
Parameter Value : 2000
Return Status = 0
3. Your jdbc code is incomplete:
where are definitions and setXXXXX calls for your output parameters?
4. You may have better luck when asking in IBM DB2 newsgroup
(comp.databases.ibm-db2).
Jan M. Nelken
- Previous message: Rico: "Re: Hibernate and log4j config under Tomcat."
- Next in thread: Lee Fesperman: "Re: is there anyone who has some idea? i am trying to call Stored procedure using JDBC"
- Reply: Lee Fesperman: "Re: is there anyone who has some idea? i am trying to call Stored procedure using JDBC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|