SipCat
SipCat

Reputation: 47

SQL UPDATE over JDBC in SAP Hana is not persistent

We are currently migrating from Oracle to SAP Hana, and we are using Java-programs that access the database via JDBC.

When I do a SQL-update to the Hana database in Java, this change is not written to the database.

After the update, I use Squirrel to check whether the table has been changed and the change is not visible!

How can I write data with UPDATE, INSERT and DELETE in Hana via JDBC?

Upvotes: 1

Views: 420

Answers (1)

Lars Br.
Lars Br.

Reputation: 10396

As SipCat found out himself, this behavior is caused by

  • using autocommit=false
  • and NOT COMMITing the changes made by the application.

In this situation, the transaction will be rolled back when the application disconnects the DB session.

Several SQL Editor/Query UI tools (like DBSquirrel) use autocommit=true or automatically issue a COMMIT after each command, so that it may appear that there is no COMMIT required or that no transaction handling would be involved.

That is a false impression. In fact, even SELECTs (which "just" read data) technically are always in a transaction context.

Upvotes: 1

Related Questions