i am trying to create a sqlite data base in a specific folder but when i run the below code, it does not create the data base file?
code:
/**path to the sqlite database folder that contains all .db files*/
public static final String SQLITE_DATABASE_FOLDER = "c:"+File.separator+"MainWorkspace"+File.separator+"SQLiteDB_Assets"+File.separator+"SQLiteDB";
....
....
....
//in the main method
NodeFactory nodeFactory = new NodeFactory();
nodeFactory.newSQLiteConn(SysConsts.TEST_DATABASE_NAME);
//member method in NodeFactory class
public void newSQLiteConn(String dbName) throws ClassNotFoundException, SQLException {
if (dbName != null) {
if (!dbName.isEmpty()) {
this.dbName = dbName;
Class.forName("org.sqlite.JDBC");
this.dbURL = "jdbc:sqlite:"+SysConsts.SQLITE_DATABASE_FOLDER+File.separator+this.dbName;
} else {
Log.e(TAG, "newSQLiteConn", "dbName is empty");
}
} else {
Log.e(TAG, "newSQLiteConn", "dbName is null");
}
}
please let me know why the data base file is not created?
SQLite allows you to set parameters (like page size) before the database file is actually created.
The file is created when you actually write to it (e.g., create a table).