You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2007/10/14 20:18:50 UTC

[jira] Updated: (DERBY-2073) Inserting BigDecimal value in PreparedStatement into double column loses fractional digits

     [ https://issues.apache.org/jira/browse/DERBY-2073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2073:
----------------------------------

    Attachment: NegativeScaleTest.java

Thanks Knut for pointing out the negative scale case. I get an overflow error with my patch.  Without the patch it passes ok on client with negative scale.  I'll take a closer look at how best to resolve the issue.


[C:/kmarsden/repro/DERBY-2073] java NegativeScaleTest
Embedded
        PASS: got expected value:2000.00
        PASS: got expected value:2000.0
        PASS: got expected value:2000.0
        PASS: got expected value:2E+3
client
Exception in thread "main" java.sql.SQLDataException: Overflow occurred during numeric data type conversion of '2E+3' to
 packed decimal.
        at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
        at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362)
        at org.apache.derby.client.am.PreparedStatement.executeUpdate(PreparedStatement.java:391)
        at NegativeScaleTest.testNegativeScale(NegativeScaleTest.java:28)
        at NegativeScaleTest.main(NegativeScaleTest.java:16)
Caused by: org.apache.derby.client.am.SqlException: Overflow occurred during numeric data type conversion of '2E+3' to p
acked decimal.
        at org.apache.derby.client.am.Decimal.bigDecimalToPackedDecimalBytes(Decimal.java:398)
        at org.apache.derby.client.net.Request.writeBigDecimal(Request.java:1497)
        at org.apache.derby.client.net.NetStatementRequest.buildFDODTA(NetStatementRequest.java:733)
        at org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcommandData(NetStatementRequest.java:536)
        at org.apache.derby.client.net.NetStatementRequest.writeExecute(NetStatementRequest.java:143)
        at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(NetPreparedStatement.java:172)
        at org.apache.derby.client.am.PreparedStatement.writeExecute(PreparedStatement.java:1784)
        at org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:2030)
        at org.apache.derby.client.am.PreparedStatement.executeUpdateX(PreparedStatement.java:396)
        at org.apache.derby.client.am.PreparedStatement.executeUpdate(PreparedStatement.java:382)
        ... 2 more
[C:/kmarsden/repro/DERBY-2073]











































> Inserting BigDecimal value in PreparedStatement into double column loses fractional digits
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2073
>                 URL: https://issues.apache.org/jira/browse/DERBY-2073
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.2.1
>         Environment: windows xp
>            Reporter: Lukasz P
>            Assignee: Kathey Marsden
>         Attachments: BigDecimalProblemTester.java, NegativeScaleTest.java
>
>
> Create table with column of type double.
> Create a prepared statement which inserts value to this column.
> use preparedStatement#setBigDecimal method of the statement to set value of the column.
> Execution of such statement succeeds, but actual value in db has no fractional digits.
> You can use attached test class to reproduce this problem

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.