Java problems with db.getSize() ..any help?

Hi

I get this message “Integer literal out of range Decimal nt must be in the range -2147483648 to 2147483648” when I compare the size of a database with a value

getSize is supposed to return a double

I’ve tried to cast it to a long but I still get the error

example…

dbsize=(long) db.getSize();

if ( dbsize<4000000000)…

I have made a java test agent which prints out the size of the databases, with and without casting to a long.

any help ?

regards

Jesper Kiaer

http://www.jezzper.dk

Subject: java problems with db.getSize() …any help?

Jesper Kiaer wrote:dbsize=(long) db.getSize();

if ( dbsize<4000000000)…

Your problem is here. You have specified a literal value that is too large for any of the built in integral values in Java. double is used as the return for getSize() because long does not allow a large enough range. To fix this, simply stay with the double as the type and compare like values, like this:

double dbsize = db.getSize();

if (dbsize < 4000000000.0)

{

  // ...

}

I think this gives you what you are looking for. Good luck

–Joe

Joseph Millar

Principal Software Engineer

Brightline Technology

Subject: RE: java problems with db.getSize() …any help?

Thanks!

I think I just got a little bit confuessed by the error message

Are you no longer at Lotus/IBM?

regards

Jesper Kaer

http://www.jezzper.dk

Subject: RE: java problems with db.getSize() …any help?

No, IBM decided to lay me off back in April.

–Joe

Joseph Millar

Principal Software Engineer

Brightline Technology