Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to convert a string to double & insert it in mysql table as bigint(24)

807605Aug 22 2007 — edited Aug 22 2007
hi,

i have built a mysql table which has field"messageid" bigint(24),
i want to insert values to this field at runtime..
in my programe there is string messageid="07168383580606200700000"
i parse this value to a double/long but it give numberformat exception.

by configuring the messageid field as varchar(24), this can be done easily.
but when it comes to any form of int type, the converting part gives numberformatexception.
as im involving wit complex process of quering database it is essential to keep the field as int.


double messageid1=0;
try{
messageid1=Double.parseDouble(messageid);
}
catch(NumberFormatException e){
messageiderror(messageid,message," Invalid MessageID");
return 0;
}


now it gives an exception "Data truncated for column 'MessageID' at row 1"
only the catch block is executed. can anyone help me to get rid of this,


thanks in advance
dushi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2007
Added on Aug 22 2007
8 comments
871 views