Record Store help!!!!!

When I delete a record store I find that I have to quit the midlet application completely and then re-enter it before the midlet recognises that the record store has been deleted. What im saying is that the record store is where the data for a list of names is retrieved from. When i delete the record store and take a look at the name listing I still find the list is populated with the deleted record store names??? Its only when i exit the midlet and the re-enter it that i find the name listing is properly updated i.e. not displaying any names.
Can you please tell me, anybody, why this is and is there a way that i can reset the midlet so that it recognises the change in the record store when it is deleted without having to exit the midlet.
Thanks.

Sure here you go,
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import java.util.*;
import javax.microedition.rms.*;
public class AddPlayerScreen extends Form implements CommandListener
     private RecordStore rs;
     private Display display;
     private GSAP midlet;
     private ScoreArray sa;
     private TextField firstName = new TextField("First name:", "", 50, TextField.ANY);
     private TextField lastName = new TextField("Last name:", "", 50, TextField.ANY);
     private TextField telNumber = new TextField("Tel. number:", "", 20, TextField.PHONENUMBER);
     private TextField emailAddress = new TextField("Email address:", "", 50, TextField.EMAILADDR);
     private TextField handicap = new TextField("Handicap:", "", 2, TextField.NUMERIC);
     private Command back = new Command("Back", Command.BACK, 0);
     private Command accept = new Command("Accept", Command.OK, 1);
     private Command viewNote = new Command("View player note", Command.SCREEN, 1);
     private Command clear = new Command("Clear", Command.OK, 1);
     private Command detailedNote = new Command("Add player note", Command.SCREEN, 1);
     private Ticker addPlayerTicker = new Ticker("Please enter player details.");
     public AddPlayerScreen(GSAP midlet)
          super("NEW PLAYER DETAILS");
          this.midlet = midlet;
          append(firstName);
          append(lastName);
          append(telNumber);
          append(emailAddress);
          append(handicap);
          addCommand(back);
          addCommand(accept);
          addCommand(viewNote);
          addCommand(clear);
          addCommand(detailedNote);
          setTicker(addPlayerTicker);
          setCommandListener(this);
     public void commandAction(Command c, Displayable d)
          String label = c.getLabel();
          if(label.equals("Back"))
               midlet.playerMenuScreenShow();
          else if(label.equals("Accept"))
               addRecord();
               RecordStoreDetails();
          else if(label.equals("Add player note"))
               note();
          else if(label.equals("View player note"))
               //System.out.println("View player note");
               sa.go();
          else if(label.equals("OK"))
               System.out.println("Note saved");
               midlet.addPlayerScreenShow();
          else if(label.equals("Clear"))
               firstName.setString("");
               lastName.setString("");
               telNumber.setString("");
               emailAddress.setString("");
               handicap.setString("");
     public void note()
          TextBox note;
          Command ok;
          ok = new Command("OK", Command.BACK, 1);
          note = new TextBox("Player note: ", "", 243, TextField.ANY);
          note.addCommand(ok);
          note.setCommandListener(this);
          note.setString("");
          Display.getDisplay(midlet).setCurrent(note);
     //Method to create record store if not already created and add record
     public void addRecord()
          RecordStore rs = null;
          //add a record.
          try
               //Open record store or create it if it does not exist.
               rs = RecordStore.openRecordStore("PLAYERSTORE", true);
               System.out.println("PLAYERSTORE open");
               String stringRecord = firstName.getString() +","+ lastName.getString() +","+ telNumber.getString() +","+ emailAddress.getString() +","+ handicap.getString();
               byte []recordBytes = stringRecord.getBytes();
               int recordId = rs.addRecord(recordBytes,0,recordBytes.length);
               System.out.println("A record has been added");
               System.out.println("Close the record store");     
               playerAddedAlert();
          catch(RecordStoreNotFoundException rsnfe)
               System.out.println("The record store you are trying to open does not exist :"+rsnfe);
          catch(RecordStoreFullException fsfe)
               System.out.println("The record store cannot store anymore data :"+fsfe);
          catch(RecordStoreException rse)
               System.out.println("An error has occured when using the record store :"+rse);
          try
               rs.closeRecordStore();
               System.out.println("PLAYERSTORE closed");
          catch( RecordStoreNotOpenException e )
               System.out.println("Record store already closed!");
          catch( RecordStoreException e )
               System.out.println("Exception:"+e);
     public void playerAddedAlert()
          Alert message = new Alert("PLAYER SUCCESSFULLY ADDED", "The player " + firstName.getString() +" "+ lastName.getString() + " has been successfully added.", null, AlertType.INFO);
          Display.getDisplay(midlet).setCurrent(message);
          message.setTimeout(3000);
          firstName.setString("");
          lastName.setString("");
          emailAddress.setString("");
          handicap.setString("");
          telNumber.setString("");
//-----------------------------------------------------------------------------Method to test the RecordStore, this is a method that was used during the testing of this MIDlet---------------------------------------------------------------------------------------------------------------
     public void RecordStoreDetails()
          try
               //Open record store or create it if it does not exist.
               rs = RecordStore.openRecordStore("PLAYERSTORE", true);
               System.out.println("The name of the recordstore is: "+rs.getName());
               System.out.println("The record store was last modified on: "+rs.getLastModified());
               System.out.println("The record store version is: "+rs.getVersion());
               System.out.println("The size of the record store is: "+rs.getSize());
               System.out.println("The available space for the record store to use is: "+rs.getSizeAvailable());
          catch(RecordStoreNotFoundException rsnfe)
               System.out.println("The record store you are trying to open does not exist :"+rsnfe);
          catch(RecordStoreFullException fsfe)
               System.out.println("The record store cannot store anymore data :"+fsfe);
          catch(RecordStoreException rse)
               System.out.println("An error has occured when using the record store :"+rse);
          try
               rs.closeRecordStore();
               System.out.println("PLAYERSTORE closed");
          catch( RecordStoreNotOpenException e )
               System.out.println("Record store already closed!");
          catch( RecordStoreException e )
               System.out.println("Exception:"+e);
So you can see that a player is added to the record store, but when i try and take a look at a list of players that I have constructed the player just added is not present??? Its only when I exit the MIDlet completely and then re-enter it that the player list is fully updated with the new player.

Similar Messages

  • Help needed in deploying a record store

    i have to deploy a MIDlet suite over OTA my MIDlet is not able to access Record store which is in /home/Rizwan/WTK2.2/appdb/DefaultColorPhone/record.db how
    Jaring is achieved
    Thankx in advance

    You can't jar and deploy it. You'll need to fill the RMS from some file in your jar the first time you start your midlet.

  • Getting Problem after Deleting a record from Record Store

    I am trying to create a simple application for mobile device. This application storing some records. I used RMS for this. These records i show in a list. But i tried to show list of records after deleting any record then list shows only prior records of deleted records n then shows exception as
    Recordsjavax.microedition.rms.InvalidRecordIDException
    The code i written as follows
    For storing data
    public void storeExercise(String EName, String Etime)
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    try
    byte[] outputRecord;
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DataOutputStream outputdataStream = new DataOutputStream(outputStream);
    outputdataStream.writeUTF(EName);
    outputdataStream.writeUTF(Etime);
    outputdataStream.flush();
    outputRecord = outputStream.toByteArray();
    recordstore.addRecord(outputRecord, 0, outputRecord.length);
    outputStream.reset();
    outputStream.close();
    outputdataStream.close();
    zlist.append(EName+Etime, null);
    display.setCurrent(zlist);
    catch (Exception error)
    System.out.println("Exception in writing Records"+error);
    for getting records
    public void getExercise(ZimList zlist)
    this.zlist = zlist;
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    //recordstore.closeRecordStore();
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    try
    //System.out.println("Hello");
    String Ename = null;
    String Etime = null;
    byte[] byteInputData = new byte[100];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    for (int x=1; x<= recordstore.getNumRecords() ; x++ )
    System.out.println("Record Id ="+x);
    //if (x != InvalidRecordID)
    recordstore.getRecord(x, byteInputData, 0);
    Ename = inputDataStream.readUTF();
    Etime = inputDataStream.readUTF();
    inputStream.reset();
    Final = Ename + Etime;
    System.out.println("Insert" + Final);
    zlist.insert(x-1,Final,null);
    inputStream.close();
    inputDataStream.close();
    //recordstore.closeRecordStore();
    catch (Exception error)
    System.out.println("Exception in Reading Records"+error);
    /*if (recordstore.listRecordStores() != null)
    try
    recordstore.deleteRecordStore("My Record Store");
    catch (Exception error)
    System.out.println("Exception"+error);
    And for deleting records I write
    public void deleteExercise(int index)
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    //recordstore.closeRecordStore();
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    if (recordstore.listRecordStores() != null)
    try
    byte[] byteInputData = new byte[100];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    for (int x=1; x<= recordstore.getNumRecords() ; x++ )
    recordstore.getRecord(x, byteInputData, 0);
    if (x == index)
    recordstore.deleteRecord(index);
    //x--;
    inputStream.reset();
    break;
    inputStream.close();
    inputDataStream.close();
    catch (Exception error)
    System.out.println("Exception in Deleting Records"+error);
    Please Help me bcz i am new in j2me development n having no experience

    Ok ...
    When you add records in you store, the J2ME implementation create an ID.
    In the database, there is a list like that with ID <--> ]byte[ ]
    You can get back a record with a this ID.
    When you delete a record, it deletes the row. Lets say you have stored 3 records and that the ID are 1, 2, 3 ... if you delete the second one, then you have still in the database IDs 1 and 3.
    That's why you have this exception : you are iterating with an ID 1, 2, 3, 4, 5 ... if one is delete there is no reorganization. (If you add an other record, it could be stored with ID 2).
    To read all the records, you should get a list of existing IDs. Take a look at the API. Here is a piece of code, that you work but I have not tested :
    RecordStore rs;
    RecordEnumeration re = rs.enumerateRecords(null, null, false);
    while (re.hasNextElement()) {
      String str = new String(re.nextRecord());
      System.out.println("Record: " + str);         
    } Hope it will help you.
    Regards

  • Implementing a record store in a J2SE environment.

    Hi,
    I am new to J2ME, I am basically learning it as I go. What i am trying to do is convert a J2ME application so that it can run in a J2SE environment. I am intending on running several instances of this application in a desktop environment so I can perform scalability testing.
    The trouble I am having is finding a way to implement the record store that is usually implement by the different classes that are included in the "import javax.microedition.rms.*" in the desktop environment.
    If anybody has any suggestions as to how this could be implemented. please get back to me.
    Thanks,
    Darryl Smith

    Hi,
    I did kind of find a solution to this issue. I came across some code online that basically convert the j2me record store class into a j2se record store.
    Take a look at the code here: http://www.mrl.nott.ac.uk/~cmg/EQUIP2/
    I did however have to do a fair bit of tweaking to get it to do what i wanted but by looking at this code i got an idea of what i needed to do.
    Hope this helps.

  • Read from multiple record stores sequentially

    I am a newbie using OEID 3.0 and CloverETL to store some crawled data (using IAS) in the data domain. I am crawling each website in a separate record store, and I've encountered this problem in CloverETL I can't resolve:
    So I have multiple record stores (e.g., rs1, rs2,..., rs1000), and what I need to do is to run a graph (the same graph) sequentially for all these record stores, through changing the record store name in "Record Store Reader" component. The graph simply stores the RS data in a data domain. Could you help me how to achieve this? Basically I need a loop to rerun the graph each time through changing the "Record Store Instance" property at each iteration.
    Thanks!

    I noticed you said you were doing website crawls with IAS (as opposed to CMS or FileSystem crawls).  Personally, when crawling website, I always prefer to output the crawl to XML instead of a recordstore.  Since webcrawls do not have any CDC mechanism (change data capture) you're really left conducting the whole crawl every time as there is no way to detect website page change to only crawl what's changed incrementally.  For FileSystem crawls and CMS crawls, recordstores are very handing in accomplishing and tracking the incremental change. 
    So, if you do decide, like me, to output to XML for your website crawls, you can forego the RS read and simply use a XML reader to pick up multiple XML files.
    HTH,
    Dan
    http://branchbird.com

  • CAS - Record Store instances Consistency- Guided Search V 11.1

    Hi,
    I'd like to get some feedback in terms of using the traditional Forge/pipeline process Vs new CAS-based process with record stores (forge less process) with “Store Merger” crawler. The latest oracle documentation recommends using CAS for any data ingestion process, however I’d like to know how it performs in a real production environment/known bugs/Are there any big retail customers who is using this new process.
    Planning to push the products and the dim val records in the record store instances using the record store java client directly from the backend/PIM (Product information management system). (Product data flow is : PIM >> Enterprise BUS >> Record Store instances). Would like to know the stability/reliability of record store instances.
    Any help is appreciated
    Thanks
    Mohamed

    Sorry, no, you can't back up the CAS record stores with that approach.  The two approaches to backing up CAS are to:
    - Shut down the CAS service and back up the /CAS/workspace/state folder
    - Use the recordstore-cmd.sh script to read data from the record stores
    Page 151 in this document has some more details.   ( http://docs.oracle.com/cd/E55325_01/CAS.110/pdf/CASDevGuide.pdf )
    Note that you can't replace the underlying database with one of your choosing as it's all baked into the product.

  • Accessing Record Store from another MIDlet.

    I have made a midlet that creates a record store.After that I have created another midlet that want to acces te recordstore.
    I always get an error : Cannot find record store file !
    I have tried to add the 2 midlets in 1 jar each in a seperate directory but i still get this error.
    CODE midlet 1 :
    rs = RecordStore.openRecordStore("Services_preferences", true , RecordStore.AUTHMODE_ANY, true);
    String record = "D1 D2 D3";
    byte[] data = record.getBytes();
    int id = rs.addRecord(data, 0, data.length);
    rs.closeRecordStore();
    CODE midlet 2 :
    RecordStore rs = null;
    rs = RecordStore.openRecordStore("Services_preferences","VendorTTUI","TTUI");
    rs.closeRecordStore();
    --> I use the wireless toolkit version 2.2
    Can somebody help me?
    thanks in advance

    It's ok, I finally figured it out!

  • Record Store only reads one record problem

    I have a problem where I can read and write a record to a records store, but i can not do this for multiple records as i am trying with below code. Any help is very welcomes thank you, I am very new to J2ME.
    I have a J2ME midlet that calls the startRecordStore() method which create a record 1.
    It uses a static int records and it increments it every time a new recordstore is created, well I am not entirely sure if i need to do this. Because I want to go through all the records created.
    public void startRecordStore() {
         // Incremenets records count
         // Temporary example for this workshop only
         records+=1;
         try { rs = RecordStore.openRecordStore("StudentStore"+records+"", true);
         catch (Exception err) {
              Alert alr = new Alert("Error Creating", err.toString(), null, AlertType.WARNING);
              alr.setTimeout(Alert.FOREVER);
              display.setCurrent(alr);
    }Then it calls the readData() method which reads the data from the 3 fields, something like this
    for(int i=0;i<count;i++) {
              ods.writeUTF(ReadDataString);
              ods.writeUTF(ReadDataString[i+1]);
              ods.writeInt(ReadDataInt[i]);
              ods.flush();
              // Put the whole write stream to a byte
              ReadDataByte = os.toByteArray();
              // finally add the fetchDataType to to a record store
              rs.addRecord(ReadDataByte, 0, ReadDataByte.length);
         os.reset();
         os.close();
         ods.close();
    Then the WriteData() method is called displaying the records
    PROBLEM it only displays the last record, instead of more then one record.
    eg. StudentStore1, StudentStore2 etc etc ..
    // create record enumerator referrence to the instance
         re = rs.enumerateRecords(null,null,false);
         // go through each records using enumerator
         while(re.hasNextElement()) {
              rs.getRecord(re.nextRecordId(), ReadInputData, 0);
              buffer.append(ids.readUTF());
              buffer.append("\n");
              buffer.append(ids.readUTF());
              buffer.append("\n");
              buffer.append(ids.readInt());
              buffer.append("\n");
              Alert alr = new Alert("Currently Reading", buffer.toString(), null, AlertType.WARNING);
              alr.setTimeout(Alert.FOREVER);
              display.setCurrent(alr);
         // CLOSE INPUT STREAM
         is.close();Any idea thanks guys

    public void startRecordStore() {
        records+=1;
        try {
            rs = RecordStore.openRecordStore("StudentStore"+records+"", true);
        }Are you sure this is what you want to do?
    I don't know where you're calling startRecordStore(), but you're creating a new record store for each "records".
    Shouldn't you be just opening the record store "StudentStore", and them adding records to that store?
    jc

  • Download byte code to record store and more?

    How can i download extra byte code (than the jar byte code) to the record store & then execute it?
    Also,i have an Image in server & want to download it to record store...how can i do this?Also,how can i set the wtk1.0.4 so i can download this image for testing?
    Please help! Thanks.

    You can't download extra byte code and then execute it ...
    (you can't not do any class loader trick too because of J2ME restrictions)
    But you can download an image and store it thanks to RMS. It as been described a lot in this forum. get the strem, store the bytes in an array and put it into a Record.
    Regards.

  • Record Store & Messaging

    Sorry for disturbing.
    But i wanna to know e-books ,that talks about RMS and record store,and i wanna know if there is an e-books for messaging in J2ME.thx a lot

    Can't help you with e-books, but there are a lot of tutorials on the net covering RMS usage and programming. Use Google and search for "J2ME RMS tutorial"

  • I keep trying to buy a song on the itunes store but every time I enter my apple id it says "Cannot connect to iTunes store" help please!

    I keep trying to buy a song on the itunes store but every time I enter my apple id it says "Cannot connect to iTunes store" help please!

    Hello seth53,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Best of luck,
    Mario

  • How can I convert string to the record store with multiple records in it?

    Hi Everyone,
    How can I convert the string to the record store, with multiple records? I mean I have a string like as below:
    "SecA: [Y,Y,Y,N][good,good,bad,bad] SecB: [Y,Y,N][good,good,cant say] SecC: [Y,N][true,false]"
    now I want to create a record store with three records in it for each i.e. SecA, SecB, SecC. So that I can retrieve them easily using enumerateRecord.
    Please guide me and give me some links or suggestions to achieve the above thing.
    Best Regards

    Hi,
    I'd not use multiple records for this case. Managing more records needs more and redundant effort.
    Just use single record. Create ByteArrayOutputStream->DataOutputStream and put multiple strings via writeUTF() (plus any other data like number of records at the beginning...), then save the byte array to the record...
    It's easier, it's faster (runtime), it's better manageable...
    Rada

  • I have a Macbook Pro that I have just renewed and transferred over my old hard drive (also from a Macbook Pro). Now when I turn on the computer and ITunes opens I get error (-50) and then error 5002 when I try to sign in to ITunes Store - Help!

    I have a Macbook Pro that I have just renewed and transferred over my old hard drive (also from a Macbook Pro). Now when I turn on the computer and ITunes opens I get error (-50) and then error 5002 when I try to sign in to ITunes Store - Help!
    My dealer has tried and failed (twice) to correct this and I have tried deleting the two items in the Itunes folder but no luck!

    were you able to get help on this?  I need help on error 5002 as well.  thank you

  • Captivate 8 Tin Can - problem communicating with the learning record store

    When publishing a course to Tin Can format, what should I enter in the 'Identifier' field?
    If I publish with the default 'Course_ID1' text, I get an error when launching the course on our LMS. Errors says "There was a problem communicating with the learning record store."

    Hello,
    Welcome to Adobe Forums.
    Please share your contact information via [email protected]
    Thanks,
    Vikram Gaur
    Adobe Support

  • Record store size?

    are there any limitations to which a record store can expand?
    or to maximum number of record store a application can create?
    thanks

    Thanks for replying.
    I have found that older phones (mainly MIDP 1.0) have fixed size of space allocated to application. Say, on Nokia 6610 the application cannot take more than 20400 bytes.
    But, newer phones (MIDP 2.0) like Nokia 6230,3220,6600 have shared storage space and an application can consume all that is available.
    This implies we cannot make an application which requires more than ~19KB data on older phones.
    It would be great if some one could further throw some light on this issue?

Maybe you are looking for