Quantcast
Channel: SCN : All Content - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 3285

Numeric Overflow via JDBC in HANA

$
0
0

Hi,

 

Now, i met a problem that using JDBC to connect to the HANA DB via a Java Tool.

 

We defined a table have one column which type is decimal(38,0), then we use java statement like below:

 

PreparedStatement st = hana.prepareStatement("insert into abc.test values (?)");

 

st.setBigDecimal(1, new BigDecimal("15950736261379882735954044794195154896"));

 

st.executeUpdate();

 

After we execute this example application we got the exception like below:

 

com.sap.db.jdbc.exceptions.jdbc40.SQLDataException: [314]: numeric overflow:

  at com.sap.db.jdbc.exceptions.jdbc40.SQLDataException.createException(SQLDataException.java:40)

  at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:278)

  at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateDatabaseException(SQLExceptionSapDB.java:185)

  at com.sap.db.jdbc.packet.ReplyPacket.buildExceptionChain(ReplyPacket.java:100)

  at com.sap.db.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:1130)

  at com.sap.db.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:877)

  at com.sap.db.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.java:492)

  at com.sap.db.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.java:341)

  at com.sap.db.jdbc.CallableStatementSapDB.executeUpdate(CallableStatementSapDB.java:884)

  at com.sap.db.jdbc.trace.PreparedStatement.executeUpdate(PreparedStatement.java:174)

 

But in the HANA studio i can execute same sql statement successfully. Do someone knows the root cause? is that we need to apply for a new JDBC version for HANA?

 

Thanks

 

Steven


Viewing all articles
Browse latest Browse all 3285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>