Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: problem in retrieving data via RMS

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question problem in retrieving data via RMS

    hi friends...
    I have Written some codes for adding and retrieving data from RMS:
    public void commandAction(Command command, Displayable displayable) {
            if(command==exit)
            {
                destroyApp(true);
                notifyDestroyed();
            }
            else if(command==start)
            {
                try
                {
                    recordstore=RecordStore.openRecordStore("My RecordStore",true);
                }
                catch(Exception error)
                {
                    alert=new Alert("Error Creating",error.toString(),null,AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
                }
                try
                {
                    String outPutData[]={"Mary","Bob","Adam"};
                    for(int x=0;x<3;x++)
                    {
                    byte[] byteOutPutData=outPutData[x].getBytes();
                    recordstore.addRecord(byteOutPutData,0,byteOutPutData.length);
                    }
                }
     
                catch(Exception error)
                {
                        alert=new Alert("Error Waiting",error.toString(),null,AlertType.WARNING);
                        alert.setTimeout(Alert.FOREVER);
                        display.setCurrent(alert);
                }
                try 
                {
                    byte[] byteInputData=new byte[1];
                    int length=0;
                    for(int x=1;x<=recordstore.getNumRecords();x++)
                    {
                        if(recordstore.getRecordSize(x)>byteInputData.length)
                        {
                            byteInputData=new byte[recordstore.getRecordSize(x)];
                        }
                        length=recordstore.getRecord(1,byteInputData,0);
                    }
                    alert = new Alert("Reading", new String(byteInputData, 0,length), null, AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
     
     
                }
                catch (Exception error)
                {
                   alert = new Alert("Error Reading", error.toString(),null, AlertType.WARNING);
                   alert.setTimeout(Alert.FOREVER);
                   display.setCurrent(alert); 
                }
                try
                {
                    recordstore.closeRecordStore();
                }
                catch (Exception error) 
                {
                    alert = new Alert("Error Closing", error.toString(),null, AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
                }
                if (RecordStore.listRecordStores() != null)
                {
                    try
                    {
                        recordstore.deleteRecordStore("MY RecordStore");
                    }
                    catch (Exception error)
                    {
                        alert = new Alert("Error Removing", error.toString(),null, AlertType.WARNING);
                        alert.setTimeout(Alert.FOREVER);
                        display.setCurrent(alert);
                    }
                }
            }
        }


    but when i run it , instead of my record i see this error :
    Attached Images Attached Images


Similar Threads

  1. .xls data structure
    By helloworld922 in forum JDBC & Databases
    Replies: 3
    Last Post: August 20th, 2009, 07:12 PM
  2. Replies: 4
    Last Post: August 13th, 2009, 05:54 AM
  3. I can't key in the data
    By muffin in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 10th, 2009, 11:03 PM
  4. Virutal File Directory from Given dAta
    By hugsheals in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: July 28th, 2009, 03:39 AM
  5. Problem on sending vectors from Java server to C# client
    By MS_Dark in forum Java Networking
    Replies: 2
    Last Post: July 7th, 2009, 02:35 PM