I created the following program based on the sample from the API documentation and your code;
PHP Code:
import javax.microedition.io.file.FileSystemRegistry;
import java.util.Enumeration;
import net.rim.device.api.database.Database;
import net.rim.device.api.database.DatabaseFactory;
import net.rim.device.api.database.Statement;
import net.rim.device.api.io.URI;
import net.rim.device.api.system.Application;
public class AddDatabaseTable extends Application
{
public static void main(Stringxxx91;xxx93; args)
{
AddDatabaseTable app = new AddDatabaseTable();
try
{
Enumeration en = FileSystemRegistry.listRoots();
while (en.hasMoreElements()) {
System.out.println(en.nextElement());
}
//URI myURI = URI.create("/SDCard/test.db");
URI myURI = URI.create("/SDCard/Databases/SQLite_Guide/DatabaseSample.db");
Database d = DatabaseFactory.openOrCreate(myURI);
Statement st = d.createStatement( "CREATE TABLE 'People' ( "+"'Name' TEXT, " + "'Age' INTEGER )" );
st.prepare();
st.execute();
st.close();
}
catch ( Exception e )
{
System.out.println( e.getMessage() );
}
}
}
The file is created in the simulated SDCard, but only if it is mounted. When you run your code do you get an exception? If so what is exceptiion and message? Try using the FileSystemRegistry fragment to ensure that you actually have the file system you want to create the DB on. You will want to do this for any final code anyway.