Note that there are some explanatory texts on larger screens.

plurals
  1. POBlackberry not creating a valid sqlite database
    text
    copied!<p>I have a very unusual problem.</p> <p>I'm trying to create a simple database (6 tables, 4 of which only have 2 columns). I'm using an in-house database library which I've used in a previous project, and it does work.</p> <p>However with my current project there are <em>occasional</em> bugs. Basically the database isn't created correctly. It is added to the sdcard but when I access it I get a <code>DatabaseException</code>.</p> <p>When I access the device from the desktop manager and try to open the database (with SQLite Database Browser v2.0b1) I get "File is not a SQLite 3 database".</p> <p><strong>UPDATE</strong><br> I found that this happens when I delete the database manually off the sdcard. Since there's no way to stop a user doing that, is there anything I can do to handle it?</p> <p><strong>CODE</strong> </p> <pre><code>public static boolean initialize() { boolean memory_card_available = ApplicationInterface.isSDCardIn(); String application_name = ApplicationInterface.getApplicationName(); if (memory_card_available == true) { file_path = "file:///SDCard/" + application_name + ".db"; } else { file_path = "file:///store/" + application_name + ".db"; } try { uri = URI.create(file_path); FileClass.hideFile(file_path); } catch (MalformedURIException mue) { } return create(uri); } private static boolean create(URI db_file) { boolean response = false; try { db = DatabaseFactory.create(db_file); db.close(); response = true; } catch (Exception e) { } return response; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload