×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Record Management Store issue

    Hi all

    I tried executing the following code for maintaining a record store. The issue I am facing is that the first time when I run this code the record store is created and data is inserted in it.

    package temp;


    import javax.microedition.midlet.*;
    import javax.microedition.rms.*;

    public class recordstore extends MIDlet {

    public recordstore() {
    }
    public void startApp() throws MIDletStateChangeException {
    String s="";
    RecordStore rs=null;
    System.out.println(s);
    try {

    rs = RecordStore.openRecordStore("file6",true);
    String temp="This is for phone number 5550001";
    rs.addRecord(temp.getBytes(), 0,temp.getBytes().length);
    System.out.println("record store file1 is opened and the record count is-->"+rs.getNumRecords());
    }catch(Exception e){
    System.out.println("Error: "+e.getMessage());
    }
    finally{
    //close the record store
    try {
    rs.closeRecordStore();
    System.out.println("record store file6 is closed");
    }catch (Exception e){
    System.out.println("Error: "+e.getMessage());
    }
    }
    destroyApp(true);
    notifyDestroyed();
    }

    /**
    * Pause the MIDlet
    */
    public void pauseApp() {
    }

    /**
    * Called by the framework before the application is unloaded
    */
    public void destroyApp(boolean unconditional) {
    }
    }


    but the second time when I try using this code with the open record store set to false ( the record store should have been returned) I am getting a record store not found exception.

    package temp;


    import javax.microedition.midlet.*;
    import javax.microedition.rms.*;

    public class recordstore extends MIDlet {

    public recordstore() {
    }
    public void startApp() throws MIDletStateChangeException {
    String s="";
    RecordStore rs=null;
    System.out.println(s);
    try {

    rs = RecordStore.openRecordStore("file6",false);
    String temp="This is for phone number 5550001";
    rs.addRecord(temp.getBytes(), 0,temp.getBytes().length);
    System.out.println("record store file1 is opened and the record count is-->"+rs.getNumRecords());
    }catch(Exception e){
    System.out.println("Error: "+e.getMessage());
    }
    finally{
    //close the record store
    try {
    rs.closeRecordStore();
    System.out.println("record store file6 is closed");
    }catch (Exception e){
    System.out.println("Error: "+e.getMessage());
    }
    }
    destroyApp(true);
    notifyDestroyed();
    }

    /**
    * Pause the MIDlet
    */
    public void pauseApp() {
    }

    /**
    * Called by the framework before the application is unloaded
    */
    public void destroyApp(boolean unconditional) {
    }
    }


    Please help me out solve this issue.


    Regards
    Kartik

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Record Management Store issue

    Which device are you testing this on?

    Hartti

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Re: Record Management Store issue

    Hi

    I am using Sun Java Wireless Toolkit 2.5.2 and I am using the standard emulator which comes along with it.
    I am a beginer to J2ME so please don't mind if the question is a bit naive .

    Thanks and Regards
    M.Kartik

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Record Management Store issue

    Oh... emulators can be challenging in this regard. Do you restart the emulator in between?

    Hartti

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    Re: Record Management Store issue

    Hi

    I am basically trying to execute multiple instances of a single midlet(let's say if I execute the midlet thrice then I have 3 instance of the emulator) and then use a single recordstore to keep the common data between the emulator such as student profile.

    Yeah I often turn on/off the emulators.

    Regards
    M.Kartik

  6. #6
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: Record Management Store issue

    Hi kartikm0021! Welcome to Nokia Developer Discussion Boards!!

    Please give a try in a real device, if you dont have a real device, you can try in Remote Device Access

    Regards
    Gopal

  7. #7
    Nokia Developer Expert
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: Record Management Store issue

    Hello kartikm0021

    I have had this problems with WTK 2.5 before... when I turn off emulator and start it again the memory is gone.

    You can also download a nokia SDK and try it with that:

    http://www.forum.nokia.com/main/reso...ava_tools.html

    :Ruben

  8. #8
    Registered User
    Join Date
    Nov 2007
    Posts
    1

    Re: Record Management Store issue

    Sometimes the Sun WTK emulator can leave a special file called in.use in its data folder and - on the next run of the emulator - will ignore anything in the folder so it will appear as though you have lost your RMS. Anything saved during the session will also be discarded.

    Check your WTK folder for the in.use file which for me is in WTK25\appdb\DefaultColorPhone. If you use one of the other devices (DefaultGreyPhone or whatever) check there too.

    I have also found the SonyEricsson 2.5 emulators often leave the in.use file in their different folders for no reason!

    Hope this helps.

Similar Threads

  1. Register application: record store alternate
    By tgkprog@gmail.com in forum Mobile Java General
    Replies: 1
    Last Post: 2007-09-07, 08:21
  2. Record Store Management - How to save Objects?
    By Jossnaz in forum Mobile Java General
    Replies: 1
    Last Post: 2006-09-12, 21:43
  3. Record Store Management System (RMS)
    By mister318 in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2004-03-23, 16:38
  4. Record store management.
    By rosalba_2001 in forum Mobile Java General
    Replies: 0
    Last Post: 2003-09-26, 13:53
  5. Using protocol file:// with object connector
    By afinistr in forum Mobile Java General
    Replies: 2
    Last Post: 2002-06-24, 07:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×