Skip to Content
author's profile photo Former Member
Former Member

Using parameters from Java to access SAP Hana via procedures

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 15, 2012 at 08:04 PM

    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();
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.