Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

palm os and rms

cignox1cignox1 Member Posts: 33
Hi, I have a question and I was not able to find an answer over internet. I have to permanently store data on a palm os device using either rms or jrs75. I heard about some severe limitations using java and the ibm VM with palm databases but opinions are often confuse, then:
-What can I do on palm OS and what can I do not concerning data storage? I only need to write data in a 'file' and then retrive it back again in other sessions.
-Does the simulator of garnet 5.4 support these things? I wrote the following code, that works on the MIDP reference simulator provided by sun, but the palm sim halts on execution.
What's wrong?

public class database extends MIDlet
{
public Display display;
public Form form;
public RecordStore db;

public void startApp()
{
try
{
db = RecordStore.openRecordStore("HW", true);
}catch(RecordStoreException e){}

display = Display.getDisplay(this);
form = new Form("Database test");
String str = new String("Inizio Midlet...
");
form.append(str);
form.append("scrittura in corso...
");
display.setCurrent(form);

String appt = "new record";
byte bytes[] = appt.getBytes();
try
{
db.setMode(db.AUTHMODE_ANY, true);
db.addRecord(bytes,0,bytes.length);
}catch(RecordStoreNotOpenException e){ form.append("Noopen1");}
catch(RecordStoreException a){form.append("recordstore1");}

try
{
RecordEnumeration enum = db.enumerateRecords(null, null, false);
int a = enum.nextRecordId();
byte[] b = new byte[20];
db.getRecord(a, b, 0);
String s = new String(b);
form.append("contenuto database:");
form.append(s);
}catch(RecordStoreNotOpenException e){form.append("noopen2");}
catch(InvalidRecordIDException i){form.append("idinv2"); }
catch(RecordStoreException a){form.append("recordstore2");}
}

public void destroyApp(boolean c)
{
try
{
db.closeRecordStore();
}catch(RecordStoreNotOpenException e){}
catch(RecordStoreException a){}
}

public void pauseApp() {}
}
Sign In or Register to comment.