JSR75 provides facility of accessing native database like contacts, events and to-dos of phone.

The example below lists the contacts from phone book and on selection prints the phone number of selected contact.

 import java.io.*;
import java.util.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.pim.*;

public class ContactMIDlet  extends MIDlet implements CommandListener {
    
    private final Form form;
    private final Display display;
    private final Command exitCommand, findCommand;
    private TextField number;
    
    public ContactMIDlet() {
        
        findCommand = new Command("Find Contacts", Command.OK, 0);
        exitCommand = new Command("Exit", Command.EXIT, 1);
        form = new Form("Contact");
        form.addCommand(findCommand);
        form.addCommand(exitCommand);
        form.setCommandListener(this);
        display = Display.getDisplay(this);
        
    }
    
    
    public void startApp() {
        
        Displayable current = Display.getDisplay(this).getCurrent();
        
        if (current == null) {
            
            // check that the API is available
            boolean isAPIAvailable =(System.getProperty(
                    "microedition.pim.version") != null);
            
            StringBuffer sbuf = new StringBuffer(
                    getAppProperty("MIDlet-Name"));
            
            sbuf.append("\n").append(getAppProperty("MIDlet-Vendor")).
                    append(isAPIAvailable?"":"\nPIM API not available");
            
            Alert alertScreen = new Alert(null, sbuf.toString(), null, 
                    AlertType.INFO);
            
            alertScreen.setTimeout(3000);
            
            if (!isAPIAvailable) {
                display.setCurrent(splashScreen);
            } else {
                display.setCurrent(form);
            }
        } else {
            Display.getDisplay(this).setCurrent(current);
        }
    }
    
    public void pauseApp(){}
    
    public void destroyApp(boolean unconditional){}
    
    void showMessage(String message, Displayable displayable) {
        
        Alert alert = new Alert("");
        alert.setTitle("Error");
        alert.setString(message);
        alert.setType(AlertType.ERROR);
        alert.setTimeout(5000);
        display.setCurrent(alert, displayable);
        
    }
    
    void showMain() {
        display.setCurrent(form);
    }
    
    void showContactsList() {
        display.setCurrent(new ContactListForm(ContactMIDlet.this));
    }
    
    
    void contactSelected(String telephoneNumber) {
        this.setPhoneNumber(telephoneNumber);
        showMain();
    }
    
    void setPhoneNumber(String phoneNumber) {
        number = new TextField("Contact","",20,TextField.PHONENUMBER);
        number.setString(phoneNumber);
        form.append(number);
    }
    
    public void commandAction(Command cmd, Displayable displayable) {
        
        if (cmd == exitCommand) {
            notifyDestroyed();
        } else if (cmd == findCommand) {
            showContactsList();
        }
    }
}

import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.pim.*;

class ContactListForm  extends List  implements CommandListener {
    
    private final Command exitCommand, selectCommand, backCommand;
    private final ContactMIDlet parent;
    private boolean available;
    private Vector allTelNumbers = new Vector();
    
    public ContactListForm(ContactMIDlet parent) {
        
        super("Contacts", Choice.IMPLICIT);
        this.parent = parent;
        selectCommand = new Command("Select", Command.OK, 0);
        backCommand = new Command("Back", Command.BACK, 1);
        exitCommand = new Command("Exit", Command.EXIT, 1);
        addCommand(backCommand);
        addCommand(exitCommand);
        setCommandListener(this);
        setFitPolicy(Choice.TEXT_WRAP_ON);
        
        LoadContacts l = new LoadContacts();
        
    }
    
    public void commandAction(Command cmd, Displayable displayable) {
        
        // if no names are available return
        if (!available) {
            parent.showMain();
            return;
        } else if (cmd == selectCommand) {
            int selected = getSelectedIndex();
            if (selected >= 0) {
                parent.contactSelected(
                        (String) allTelNumbers.elementAt(selected));
            } else {
                parent.showMain();
            }
        } else if (cmd == backCommand) {
            parent.showMain();
        } else if (cmd == exitCommand) {
            parent.notifyDestroyed();
        }
        
    }
    
    
    // loads the names of a named contact list
    private void loadNames(String name) 
        throws PIMException, SecurityException {
        
        ContactList contactList = null;
        try {
            contactList = (ContactList) PIM.getInstance()
            .openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, name);
            
            // First check that the fields we are interested in 
            // are supported by the PIM List
            if (contactList.isSupportedField(Contact.FORMATTED_NAME)
            && contactList.isSupportedField(Contact.TEL)) {
                
                setTitle("Contacts");
                Enumeration items = contactList.items();
                delete(0);
                Vector telNumbers = new Vector();
                
                while (items.hasMoreElements()) {
                    
                    Contact contact = (Contact) items.nextElement();
                    int telCount = contact.countValues(Contact.TEL);
                    int nameCount = contact.countValues(
                            Contact.FORMATTED_NAME);
                    
                    if (telCount > 0 && nameCount > 0) {
                        String contactName =contact.getString(
                                Contact.FORMATTED_NAME, 0);
                        
                        for (int i = 0; i < telCount; i++) {
                            
                            int telAttributes = 
                                    contact.getAttributes(Contact.TEL, i);
                            
                            String telNumber = 
                                    contact.getString(Contact.TEL, i);
                            
                            telNumbers.addElement(telNumber);
                            allTelNumbers.addElement(telNumber);
                            
                        }
                        
                        // insert elements in the list in order
                        for (int i = 0; i < telNumbers.size(); i++) {
                            
                            append(contactName+ ": "+ 
                                    telNumbers.elementAt(i), null);
                        }
                        
                        telNumbers.removeAllElements();
                    }
                }
                
                available = true;
                
            } else {
                
                append("Contact list required items not supported", null);
                available = false;
            }
        } finally {
            
            // always close it
            if (contactList != null) {
                contactList.close();
            }
        }
    }
    
    private class LoadContacts implements Runnable {
        
        public LoadContacts() {
            new Thread(this).start();
        }
        
        public void run() {
            
            try {
                
                String[] allContactLists = 
                        PIM.getInstance().listPIMLists(PIM.CONTACT_LIST);
                
                if (allContactLists.length != 0) {
                    for (int i = 0; i < allContactLists.length; i++) {
                        loadNames(allContactLists[i]);
                    }
                    addCommand(selectCommand);
                } else {
                    append("No Contact lists available", null);
                    available = false;
                }
                
            } catch (PIMException e) {
                
                parent.showMessage(e.getMessage(), ContactListForm.this);
                available = false;
                
            } catch (SecurityException e) {
                
                parent.showMessage(e.getMessage(), ContactListForm.this);
                available = false;
                
            }
        }
    }
}