01-10-2012 05:09 AM
Hello everyone.
My question is simple.
I want to create a database, how can I do and created on the phone memory ?
I have tried this:
try{
URI uri3 = URI.create(
"file:///SDCard/Databases/database1.db");
but catch the following error:
Invalid path name. Path does not contains a proper root list. See FileSystemRegistry class for details.
And thank you for your help.
01-10-2012 04:34 PM
private static Database getDB() {
Database db = null;
try {
URI uri = URI
.create("file:///store/.../MyDataBase.db");
if (!DatabaseFactory.exists(uri)) {
db = DatabaseFactory.create(uri);
Statement st = db
.createStatement("CREATE TABLE IF NOT EXISTS tablename"
+ "('name1' INTEGER, 'name2' INTEGER, 'name3' INTEGER, 'name41' TEXT);");
st.prepare();
st.execute();
st.close();
} else {
db = DatabaseFactory.open(uri);
}
return db;
} catch (final Exception e) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
Dialog.alert(e.toString());
}
});
}
return db;
}
01-11-2012 07:38 AM
i tried your code with .create("file:///store/MyDataBase.db");
but got the following error:
net.rim.device.api.database.DatabaseIOException: File System not ready
07-04-2012 02:21 AM
Hello there
Did you find a sollution on how to store the database on the phone memory?
Thank you