com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field .

Spring JIRA | Yu Liu | 8 years ago
  1. 0

    We are seeing the following issue when using Spring's StoredProcedure class. Given the sample procedure and code below we get and Arithmetic overflow error if the total_rows parameter is defaulted and the proc returns >= 10 for total_rows. It appears that the default value can influence the scale of what can be returned. For example you can increase the default in factors of ten or set it to null and the below scenario works. This behaviour does not seem correct to us. CODE SNIPPET //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// import java.sql.Types; import java.util.HashMap; import java.util.Map; import javax.sql.DataSource; import org.springframework.jdbc.core.SqlInOutParameter; import org.springframework.jdbc.object.StoredProcedure; /** * @author knoxl on Oct 14, 2008 @ 6:15:58 PM * @version $Revision:$, submitted by $Author:$ */ public class TestOutParamSet extends TestCase { private DataSource dataSource; protected void setUp() throws Exception { super.setUp(); dataSource = getDataSource(""); // NOTE Need to provide your own somehow } public void test() { SetId s = new SetId(dataSource); Map m = new HashMap(); m.put("total_rows", 0l); // NOTE null would work Map r = s.execute(m); System.out.println(r); } private class SetId extends StoredProcedure { private static final String SQL = "test_set_id"; public SetId(DataSource ds) { super(ds, SQL); declareParams(); compile(); } private void declareParams() { declareParameter(new SqlInOutParameter("total_rows", Types.NUMERIC)); } } } PROC //////////////////////////////////////////////////////////////////////////////////////////////////// CREATE PROC dbo.test_set_id ( @total_rows numeric(10) = 0 OUTPUT ) AS BEGIN SELECT @total_rows = 10 END ERROR ////////////////////////////////////////////////////////////////////////////////////////////////////// org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call test_set_id(?)}]; SQL state [ZZZZZ]; error code [247]; Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field . ; nested exception is com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field . at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124) at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:949) at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:982) at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:113) at magnet.persistence.proc.TestOutParamSet.test(TestOutParamSet.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field .

    Spring JIRA | 8 years ago | Yu Liu
    com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field .
  2. 0

    We are seeing the following issue when using Spring's StoredProcedure class. Given the sample procedure and code below we get and Arithmetic overflow error if the total_rows parameter is defaulted and the proc returns >= 10 for total_rows. It appears that the default value can influence the scale of what can be returned. For example you can increase the default in factors of ten or set it to null and the below scenario works. This behaviour does not seem correct to us. CODE SNIPPET //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// import java.sql.Types; import java.util.HashMap; import java.util.Map; import javax.sql.DataSource; import org.springframework.jdbc.core.SqlInOutParameter; import org.springframework.jdbc.object.StoredProcedure; /** * @author knoxl on Oct 14, 2008 @ 6:15:58 PM * @version $Revision:$, submitted by $Author:$ */ public class TestOutParamSet extends TestCase { private DataSource dataSource; protected void setUp() throws Exception { super.setUp(); dataSource = getDataSource(""); // NOTE Need to provide your own somehow } public void test() { SetId s = new SetId(dataSource); Map m = new HashMap(); m.put("total_rows", 0l); // NOTE null would work Map r = s.execute(m); System.out.println(r); } private class SetId extends StoredProcedure { private static final String SQL = "test_set_id"; public SetId(DataSource ds) { super(ds, SQL); declareParams(); compile(); } private void declareParams() { declareParameter(new SqlInOutParameter("total_rows", Types.NUMERIC)); } } } PROC //////////////////////////////////////////////////////////////////////////////////////////////////// CREATE PROC dbo.test_set_id ( @total_rows numeric(10) = 0 OUTPUT ) AS BEGIN SELECT @total_rows = 10 END ERROR ////////////////////////////////////////////////////////////////////////////////////////////////////// org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call test_set_id(?)}]; SQL state [ZZZZZ]; error code [247]; Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field . ; nested exception is com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field . at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124) at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:949) at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:982) at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:113) at magnet.persistence.proc.TestOutParamSet.test(TestOutParamSet.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field .

    Spring JIRA | 8 years ago | Yu Liu
    com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field .
  3. 0

    If an 8-bit byte value is inserted into a Sybase TINYINT column, GenericJDBCException is thrown because of an arithmetic overflow during implicit conversion of a SMALLINT value to a TINYINT field. This is happening for MixedTest.testMixedInheritance() and InterfaceProxyTest.testInterfaceProxies(). The full stacktrace is: could not insert: [org.hibernate.test.interfaceproxy.SecureDocumentImpl]" type="org.hibernate.exception. GenericJDBCException">org.hibernate.exception.GenericJDBCException: could not insert: [org.hibernate.test.interfaceproxy.Sec ureDocumentImpl] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2640) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventL istener.java:187) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java: 172) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519) at org.hibernate.test.interfaceproxy.InterfaceProxyTest.testInterfaceProxies(InterfaceProxyTest.java:52) at org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:102) at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:34) at org.hibernate.junit.functional.FunctionalTestClassTestSuite.runTest(FunctionalTestClassTestSuite.java:100) at org.hibernate.junit.functional.FunctionalTestClassTestSuite.run(FunctionalTestClassTestSuite.java:69) Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of SMALLINT value '-10 4' to a TINYINT field . at com.sybase.jdbc3.tds.Tds.a(Unknown Source) at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.updateLoop(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(Unknown Source) at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeUpdate(Unknown Source) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2250) ... 34 more

    Hibernate JIRA | 8 years ago | Gail Badner
    org.hibernate.exception.GenericJDBCException: could not insert: [org.hibernate.test.interfaceproxy.Sec ureDocumentImpl]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    If an 8-bit byte value is inserted into a Sybase TINYINT column, GenericJDBCException is thrown because of an arithmetic overflow during implicit conversion of a SMALLINT value to a TINYINT field. This is happening for MixedTest.testMixedInheritance() and InterfaceProxyTest.testInterfaceProxies(). The full stacktrace is: could not insert: [org.hibernate.test.interfaceproxy.SecureDocumentImpl]" type="org.hibernate.exception. GenericJDBCException">org.hibernate.exception.GenericJDBCException: could not insert: [org.hibernate.test.interfaceproxy.Sec ureDocumentImpl] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2640) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventL istener.java:187) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java: 172) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519) at org.hibernate.test.interfaceproxy.InterfaceProxyTest.testInterfaceProxies(InterfaceProxyTest.java:52) at org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:102) at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:34) at org.hibernate.junit.functional.FunctionalTestClassTestSuite.runTest(FunctionalTestClassTestSuite.java:100) at org.hibernate.junit.functional.FunctionalTestClassTestSuite.run(FunctionalTestClassTestSuite.java:69) Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of SMALLINT value '-10 4' to a TINYINT field . at com.sybase.jdbc3.tds.Tds.a(Unknown Source) at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.updateLoop(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeUpdate(Unknown Source) at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeUpdate(Unknown Source) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2250) ... 34 more

    Hibernate JIRA | 8 years ago | Gail Badner
    org.hibernate.exception.GenericJDBCException: could not insert: [org.hibernate.test.interfaceproxy.Sec ureDocumentImpl]
  6. 0

    Attempting to run encoding test (admin/encodingtest.action) and it fails with a database error as follows (running jConnect 6.0 against ASE 15.0.1): Cause: com.sybase.jdbc3.jdbc.SybSQLException: Function LOWER invoked with wrong number or type of argument(s). at com.sybase.jdbc3.tds.Tds.a(Unknown Source) Stack Trace: [hide] com.sybase.jdbc3.jdbc.SybSQLException: Function LOWER invoked with wrong number or type of argument(s). at com.sybase.jdbc3.tds.Tds.a(Unknown Source) at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source) at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source) at com.mchange.v2.c3p0.impl.NewProxyStatement.executeQuery(NewProxyStatement.java:35) at com.atlassian.confluence.admin.actions.debug.EncodingTestAction.retrieveLowerDatabaseTestString(EncodingTestAction.java:117) at com.atlassian.confluence.admin.actions.debug.EncodingTestAction.execute(EncodingTestAction.java:65) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(DefaultWorkflowInterceptor.java:55) at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:39) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) The patch provided in CSP-5887 does not work for Confluence 2.5.1 A new patch is required.

    Atlassian JIRA | 10 years ago | Mei Yan Chan [Atlassian]
    com.sybase.jdbc3.jdbc.SybSQLException: Function LOWER invoked with wrong number or type of argument(s).

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.sybase.jdbc3.jdbc.SybSQLException

      Arithmetic overflow during implicit conversion of NUMERIC value '10' to a NUMERIC field .

      at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate()
    2. Spring Framework
      StoredProcedure.execute
      1. org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124)
      2. org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
      3. org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:949)
      4. org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:982)
      5. org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:113)
      5 frames
    3. magnet.persistence.proc
      TestOutParamSet.test
      1. magnet.persistence.proc.TestOutParamSet.test(TestOutParamSet.java:39)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. JUnit
      JUnit38ClassRunner.run
      1. junit.framework.TestCase.runTest(TestCase.java:168)
      2. junit.framework.TestCase.runBare(TestCase.java:134)
      3. junit.framework.TestResult$1.protect(TestResult.java:110)
      4. junit.framework.TestResult.runProtected(TestResult.java:128)
      5. junit.framework.TestResult.run(TestResult.java:113)
      6. junit.framework.TestCase.run(TestCase.java:124)
      7. junit.framework.TestSuite.runTest(TestSuite.java:232)
      8. junit.framework.TestSuite.run(TestSuite.java:227)
      9. org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
      9 frames
    6. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
      1 frame
    7. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      5 frames