Skip to Content

JDBC call to hana stored procedure with DML queries

Jul 04, 2017 at 10:03 AM


avatar image
Former Member

Hi folks,

I was trying to call a hana stored procedure from JDBC. I was able execute stored procedures which contained simple data definition sql.

But when the stored procedure contained data manipulation sql, like update and insert, even though the jdbc class runs successfully, I don't see any changes in the hana stored tables that were supposed to be updated from the stored procedure itself.

public static void main(String[] args) {, args);

		String user = "SYSTEM";
		String pwd = "******";
	      Connection connection = null;
	      try {
	         connection = DriverManager.getConnection(
	      } catch (SQLException e) {
	         System.err.println("Connection Failed. User/Passwd Error?");
	      if (connection != null) {
	         try {
	            System.out.println("Connection to HANA successful!");
	        	CallableStatement stmt = connection.prepareCall("{CALL \"SYSTEM\".\"CALLJDBC\"()}");
//		            stmt.close();
	    		} catch (SQLException e) {
	    			// TODO Auto-generated catch block

The called stored procedure contains just a bunch of insert statements with no IN or OUT parameters.

Is there a special way to execute sql insert/update statements from jdbc?

Any suggestions would be great!



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
ANIRUDDHA SHINDE Jul 12, 2017 at 05:38 AM


In Your JDBC call you have autocommit property set as false , either set this as true if you do not want explicit commit after dml statement , and in case you want this as false then use explicit commit.



Aniruddha Shinde

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for pointing out.

Now I want to replace the "localhost" with ip address for access of the hana db from remote systems so as to call a procedure remotely. But when i use the new jdbc url with the ip address, I get a connection timeout.

The url looks like: "jdbc:sap://"

Am i missing out on some configurations?