Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
Review Basis Datapada J2ME

Review Basis Datapada J2ME

Ratings: (0)|Views: 16 |Likes:
Published by Dani Bom

More info:

Published by: Dani Bom on Dec 04, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

12/05/2013

pdf

text

original

 
 BASIS DATAPADA J2ME
 
Basis Data pada Pemrograman J2ME di kenal dengan nama Record Mangement System(RMS).dalam menggunakan RMS ada banyak hal yang dapat kita lakukan untuk memanipulasi basis data baik menerima input dan megolahnya. Pada bahasan kali ini kita akan mereview mengenai RecordStore ,Menyimpan record,membaca kembali rekaman dan memanipulasi RecordStore dengan CRUD. Untuk menyimpan File di J2ME dapat kita gunakan 2 Cara yaitu 1.menyimpan data dalam sebuah file dan di letakan di folder res 2.Menggunakan recordManagementSystem(RMS). Gambar Untuk pustaka RMS
MEMBUKA RECORDSTORE
Dalam kelas RecordStore didefinisikan tiga static method untuk membuat dan membuka obyek RecordStore. Method-method tersebut adalah sebagaiberikut: a. static RecordStore openRecordStore(String recordStoreName, boolean createIfNecessary) b. static RecordStore openRecordStore(String recordStoreName, boolean createIfNecessary, int authMode, boolean writable) c. static RecordStore openRecordStore(String recordStoreName, String vendorName, String suiteName)
 
CONTOH PROGRAM :
import javax.microedition.midlet.*; import javax.microedition.rms.*; import javax.microedition.lcdui.*; import java.io.*; public class RmsMidlet extends MIDlet implements CommandListener { private RecordStore rs=null; private Form form; private String namaFile; private TextField txtBaca ; private Display display; private Command exit, Simpan, Baca; private StringItem sti; public RmsMidlet() throws RecordStoreException,IOException{ form=new Form("PILIH MENU :"); namaFile="Data_Ku"; txtBaca=new TextField("Ketik Text yang akan di Simpan :","",25,TextField.ANY); form.append(txtBaca); sti=new StringItem("HASIL BACA RECORD",""); form.append(sti); display=Display.getDisplay(this); exit=new Command("Exit",Command.EXIT,0); Simpan=new Command("Simpan",Command.OK,1);
 
 Baca=new Command("Baca",Command.OK,1); form.addCommand(exit); form.addCommand(Simpan); form.addCommand(Baca); display.setCurrent(form); form.setCommandListener(this); } public void BacaSimpan() throws RecordStoreException{ String dataS =""; int pr=0; try{ rs = RecordStore.openRecordStore(namaFile, true); dataS=txtBaca.getString(); byte[] dataArray = dataS.getBytes(); rs.addRecord(dataArray,0,dataArray.length); pr=rs.getNumRecords(); rs.closeRecordStore(); }catch (RecordStoreNotOpenException rsnoe){ form.append("salah tulis");} form.append("\n Data :"+dataS+" ..disimpan di recID-"+pr); }

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->