Esempio di codice: creazione di un database SQLite

/*
 * CreateDatabase.java
 *
 * Research In Motion Limited proprietary and confidential
 * Copyright Research In Motion Limited, 2010
 */
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.database.*;
import net.rim.device.api.io.*;
public class CreateDatabase extends UiApplication
{
    public static void main(String[] args)
    {
        CreateDatabase theApp = new CreateDatabase();
        theApp.enterEventDispatcher();
    }
    public CreateDatabase()
    {
        pushScreen(new CreateDatabaseScreen());
    }   
}
class CreateDatabaseScreen extends MainScreen
{
    Database d;
    public CreateDatabaseScreen()
    {
       LabelField title = new LabelField("SQLite Create Database Sample", 
                                          LabelField.ELLIPSIS | 
                                          LabelField.USE_ALL_WIDTH);
       setTitle(title);
       add(new RichTextField("Creating a database called " +
                             "MyTestDatabase.db on the SDCard."));
       try
       {
           URI myURI = URI.create("file:///SDCard/Databases/SQLite_Guide/" + 
                                  "MyTestDatabase.db"); 
           d = DatabaseFactory.create(myURI);
           d.close();
       }
       catch ( Exception e ) 
       {         
           System.out.println( e.getMessage() );
           e.printStackTrace();
       }
    }
}

Le informazioni sono state utili? Inviateci i vostri commenti.