Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Is 2.4MB Too Big for a Database File?

I have an SQLite database that's 2.4MB. I suspect it's the cause of lots of crashes in my app.

Has anyone included a DB that was as big or bigger? Any issues?

Thanks!

— asked August 14th 2010 by Clifton Labrum
  • crash
  • database
  • sqlite
0 Comments

4 Answers

  • Accepted Answer

    Your code includes row.close(); – that the close for the ResultSet. This is correct; it's important to close the ResultSet when you're finished with it.
    However, you should also close the database itself when you've completed all your database operations. In your code above, that would be db.close();
    Not sure though if this is related to your problem.

    — answered September 8th 2010 by David Richey
    permalink
    0 Comments
  • Nope, I don't think it is too big.

    Have you checked whether you have close your DB connections at a timely fashion after using?

    — answered August 14th 2010 by Peter Lum
    permalink
    1 Comment
    • I think I'm closing it at a good time. My code is below.

      The strange thing is, I don't always make it to my first query and my database opening before my app crashes. It seems like it might be happening on my database install.

      var rows = db.execute('query...');
      
          //Loop through each row
          while (rows.isValidRow()) {
      
              //Create row                
                 var row = Titanium.UI.createTableViewRow({
                            className: 'searchResultsRow'
                         });
      
                  var locationID =  Titanium.UI.createLabel({
                      text:rows.fieldByName('LocationID')
                      //etc.                
                  });
                  var airportName = Titanium.UI.createLabel({
                      text:rows.fieldByName('Name')
                      //etc.            
                  });
      
                  row.add(locationID);
                  row.add(airportName);
      
                  row.className = 'searchResultsRow';
      
                  data.push(row);
                  searchResults.setData(data);
      
              rows.next();        
          }
          rows.close();
      

      — commented August 14th 2010 by Clifton Labrum
  • I have had a very similar problem with a large database. In my specific case, I kept getting errors with rows.isValidRow() where it complained that rows was null. Were you ever able to find a solution for this?

    — answered August 16th 2010 by Joseph Yancey
    permalink
    1 Comment
    • As far as I can tell, the size of the database isn't a problem. I had other unrelated issues what I was able to fix.

      — commented August 17th 2010 by Clifton Labrum
  • I don't think it should be a problem per se. However I did see issues when testing on Android where some internal limit was being broken when it was trying to copy the db file to the simulator - I have to do it manually instead.

    — answered August 16th 2010 by Alan Bourke
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.