varunrao321
varunrao321

Reputation: 965

java.lang.OutOfMemoryError on BlackBerry

I sneaked through similar posts, but found no solution. I am getting this Exception when I try to insert values into database

INSERT = "INSERT INTO topnews (sid, headline, metadata, content, image_path,          image_caption , article_id, print_order, art_date, t_stamp) "+  
"VALUES("+_sid+",'"+_headline+"','"+_metadata+"','"+_content+"','"+_imagePath+"','"+_imageCaption+"',"+_articleId+",'"+_printOrder+"','"+_artDate+"','"+_tStamp+"');";
    byte[] i = INSERT.getBytes();
    long l = i.length;
    System.out.println("INSERT STATEMEN"+INSERT);
    _statement = _dbTopNews.createStatement(INSERT);            //EXCEPTION
    _statement.prepare();
    _statement.execute();
    _statement.close();

I tried finding out the length of the query that I am trying to insert. The Exception didn't occur when less than 4000 was inserted. This particular query for which the exception throwed is 4300. The same query is running healthy on Android development environment. I tried inserting the same query via sqlite into database no error occured. I think this is of decent size nothing humongous.

Upvotes: 0

Views: 345

Answers (1)

Vit Khudenko
Vit Khudenko

Reputation: 28418

In pre OS 7 the query length limit is 4 KB. You need OS 7 to overcome the limit.

Check the Release Notes - BlackBerry Java SDK - 7.0:

A query can now be up to 1 MB. In BlackBerry Java SDK 6.0, the query length limit was 4 KB

Upvotes: 4

Related Questions