cancel
Showing results for 
Search instead for 
Did you mean: 

Using parameters from Java to access SAP Hana via procedures

Former Member
0 Kudos

Hi,

i have a problem when accesing a procedure with an OUT parameter from java.

If I use a procedure without parameters, there is no problem:

     ResultSEt rs = stmt.executeQuery("CALL \"HD9240\".\"test1/bookings\"");
       

but if I call a procedure with an output parameter, the ResultSet is null
       
         rs = stmt.executeQuery("call \"HD9240\".\"TEST_NUMBER_CUSTOMERS2\"(?)");

The procedure is working in Hana Studio  and it is defined as follows:

CREATE PROCEDURE TEST_NUMBER_CUSTOMERS2( OUT numeroClientes INTEGER) language sqlscript AS
BEGIN select
  count(*)
into numeroClientes
from "HD9240"."SCUSTOM"
;

END
;


How do you pass parameters in and out from Java to Hana?

regards,
MIguel

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can use parameters as I wrote below:

PreparedStatement stmt = conn.prepareStatement("call \"HD9240\".\"TEST_NUMBER_CUSTOMERS2\"(?)");

stmt.setString(1, yourParam);

stmt.execute();

stmt.close();