hi ,
can you just tell me what exactly do you mean by getting parameters in your java code. does it mean that you want to see what are the values of parameters you have passed to a procedure? If so, then after executing the CallableStatement, type the following code.
if(true)
{
for (int i = 1; i <= NoOfParam; i++)
{
System.out.println("
Parameter " + i + " : " + cs.getString(i));
}
}
Here NoOfParam will be the number parameters those you pass to your procedure, and cs is the object of CallableStatement.
no, what I want is to know what parameters are required by my stored proc. So basically I tell it, "My Stored Proc is name 'SomeName'. What are the parameters I need to fill for this proc?" Then it puts those in for me, and then I fill the values. That's what Cmd.Parameters.Refresh() does in VB/C++. So if I had a proc name "MyProc" with:
@Something int,
@Another varchar(25)
Then if I did cmd.StoredProc = "MyProc" (and told it where to find the DB), and then did cmd.Parameters.Refresh(), the cmd would then have those parameters with null values, so i could do:
cmd.Parameters(0) = 5
cmd.Parameters(1) = "hello"
Any idea how to do that in Java/Jdbc?