-3

I'm uploading one .xlsx file with some values. In my .xlsx file entered 2345678910 in cell.Next i'm uploaded but it is saved in database 2147483647 value. Next time i'm uploaded with 8345678910 value but shows error.

ERROR: Already 2147483647 value saved.

My Reg Exp:"^[a-zA-Z0-9]*$"

How to resolve it?

Naresh
  • 55
  • 9

1 Answers1

4

@ktorn and many other commenters already commented with the answer. Use a long instead of an int in your Java code. int cannot store values larger than 2^31 - 1 = 2147483647.

leekaiinthesky
  • 5,413
  • 4
  • 28
  • 39
  • Hi i've small doubt.In my database i assigned **datatype** is varchar(255) for one field. In java i'm using **long** for getting value. Which one is best **long** or **double**. I want allow numeric values,special charecters and all... – Naresh May 18 '15 at 04:44
  • Use `long` if you want only integers, `double` if you want to include decimals. See http://stackoverflow.com/questions/415924/what-is-the-purpose-of-long-double-byte-char-in-java. – leekaiinthesky May 18 '15 at 05:42