db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DDLUTILS-152) Value out of range on an unsigned integer
Date Tue, 30 Jan 2007 06:03:33 GMT

    [ https://issues.apache.org/jira/browse/DDLUTILS-152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12468512
] 

Thomas Dudziak commented on DDLUTILS-152:
-----------------------------------------

The problem is that if you map the column to a wider Java type, then you'll have problems
when inserting too big values. There is no general solution that DdlUtils can provide, only
the user can define which mapping is best (see DDLUTILS-86)

> Value out of range on an unsigned integer
> -----------------------------------------
>
>                 Key: DDLUTILS-152
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-152
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - MySql
>         Environment: Windows XP
>            Reporter: David M. Gaskin
>         Assigned To: Thomas Dudziak
>
> The column (number 2) is defined (in a MySQL database) as:
> IP_FROM int unsigned
> The stack trace is at the end of this description.
> The problem probably occurs on all databases that have any data type of 
> (tinyint/smallint/mediumint/integer/bigint) unsigned
> The problem also occurs in the XML Schema, example:
> MySQL DDL is "IP_FROM int unsigned" that is mapped to:
>       <column name="IP_FROM" primaryKey="false" required="true" type="INTEGER" size="10"
default="0000000000" autoIncrement="false"/>
> Unsigned numeric data has to be promoted to the next larger java numeric type i.e.
> (unsigned) byte -> short
> (unsigned) short -> int
> (unsigned) int -> long
> (unsigned) long -> ???
> I use java.math.BigInteger for unsigned long in java.
> .
> Exception in thread "main" org.apache.ddlutils.DatabaseOperationException: Exception
while reading the row from the resultset
> 	at org.apache.ddlutils.platform.ModelBasedResultSetIterator.next(ModelBasedResultSetIterator.java:263)
> 	at org.apache.ddlutils.io.DataWriter.write(DataWriter.java:368)
> 	at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:448)
> 	at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:316)
> 	at de.gaskin.db.ddlutils.test.MySQLDump1.<init>(MySQLDump1.java:30)
> 	at de.gaskin.db.ddlutils.test.MySQLDump1.main(MySQLDump1.java:34)
> Caused by: com.mysql.jdbc.exceptions.MySQLDataException: '2.147483648E9' in column '2'
is outside valid range for the datatype INTEGER.
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:893)
> 	at com.mysql.jdbc.ResultSet.throwRangeException(ResultSet.java:7391)
> 	at com.mysql.jdbc.ResultSet.parseIntAsDouble(ResultSet.java:6710)
> 	at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2478)
> 	at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:2570)
> 	at org.apache.ddlutils.platform.PlatformImplBase.extractColumnValue(PlatformImplBase.java:2098)
> 	at org.apache.ddlutils.platform.PlatformImplBase.getObjectFromResultSet(PlatformImplBase.java:2021)
> 	at org.apache.ddlutils.platform.ModelBasedResultSetIterator.next(ModelBasedResultSetIterator.java:253)
> 	... 5 more

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


Mime
View raw message