| Reply | « Previous Thread | Next Thread » |
|
I have a serious problem with the Recordstore in the Nokia 3410. I am working on a simple client program for managing driving accounts for a small group of consultants. The prototype works fine in the emulator on the pc and on a Siemens phone, but it fails at very small amounts of data in the 3410. I have checked the size of the recordstore and the problem arises already at less than 10% used space. I have dropped an other project due to this problem, but if anyone has a good idea for a way around it, I would be very thankful.
Søren Levinsen |
|
In what way does it fail?
Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Hi Graham, here is a code snippet that gives the troubles:
try{ RecordStore store = RecordStore.openRecordStore("trip", true); RecordEnumeration enum = store.enumerateRecords(null, null, false); . . . The last line results in a java.lang.ArrayIndexOutOfBoundsException on the 3410 when I have 2 or more records in the store. If I reduce the size of the records I can store more records before I get the exception. Søren |
|
Hi Søren,
Hmmm... that's quite serious. I don't recall anyone mentioning a bug in RMS on the 3410 before. (But then, few people use RMS that much.) I had problems with RMS on the Series 40, and the only way around was to change the way I used RMS quite dramatically. I haven't had the same problem as you on the 3410, but then I've only done a small amount of testing on the emulator, and I don't use the enumerator. Does this happen on the emulator also? Have you tried working without the enumerator? Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Hi Graham,
thank you for your interest. No, I do not get any exceptions neither in the emulator nor on the Siemens phone. It works quite fine there. No, I have not tried to work without the enumerator in this particular case, but I dropped an earlier project due to problems that might very well be the same ones. In that project I stored a datastructure as XML in the first and only record in a Recordstore. It worked fine on the emulator and on a newer Nokia phone (I don't recall the number), but failed on the 3410 when I tried to save the data. In that case it was also the amount of data that trigerred the bug. Reducing the data to a small (and unusable) amount made the program run. I did quite a job debugging to be sure that it was not e.g. a memory problem. I will now try to rewrite the code in different ways to try to get around the bug, but I think I will end up telling the customers not to use the Nokia 3410 phone for this application. Søren |
|
Hi Søren,
My RMS problems involved deleteRecord()... I got around this by creating a separate record store for each record (!), and using deleteRecordStore() instead. Maybe you can store more data on the 3410 by using multiple record stores? (Though, if there are few potential users with this phone, it may not be worth the effort.) Best of luck with your project, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Hi Graham,
thank you for the idea, I will try that immediately! Søren |
|
Hi Graham - you're my man! It works, only problem is that it's a bit heavy to traverse the records (record stores), but that's not a show stopper.
Tanks a lot! Søren |
|
hi, grahamhughes, can you tell me how u delete the RecordStore, when I try to delete a recordstore, it always has error as "record store is still open", but I do make sure I have used close method to close it before delete. thanks.
|
|
The only way to delete a record store is:
Code:
RecordStore.deleteRecordStore ("myrecordstore");
You may experience other problems if record stores are left open. For this reason, I recommend that the record store is opened and closed in the same method, not left open for long periods of time. Then, a try-finally block can be used to ensure that the record store is closed under all circumstances. Code:
try {
RecordStore rs = RecordStore.openRecordStore ("data", true);
try {
// add, retrieve, update or delete records
}
finally {
rs.closeRecordStore ();
}
}
catch (RecordStoreException e) {
// report exception
}
You should be able to test to see if a record store is open like this: Code:
boolean isOpen (RecordStore rs) {
boolean bOpen;
try {
rs.getSize ();
bOpen = true;
}
catch (RecordStoreNotOpenException e) {
bOpen = false;
}
return bOpen;
}
Code:
void ensureClosed (RecordStore rs) {
boolean bCouldBeOpen = true;
while (bCouldBeOpen) {
try {
rs.closeRecordStore ();
}
catch (RecordStoreNotOpenException e) {
// we know it isn't open now!
bCouldBeOpen = false;
}
}
}
Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
how nice u r!
|
|
Been reading through old RMS posts and got curious about some stuff.
I know RMS memory limits are device specific. But is it limited per RecordStore or is it limited per Midlet or per midlet suite? Or is that device specific too? One of the posts on this forum mentioned that updating a recordstore doesn't overwite the info, but rather appends it, so to effectively overwrite it, I'd have to recreate the recordstore and rewrite all the info. Is it still true? Thanks. |
|
Limits will be device-specific. The limits given for Nokia Series 40s (60s have no specific limit) are per MIDlet suite.
The problem of records always appending: I think you're refering to a bug on older Series 60s where record stores seem to grow and grow until they choke the phone. It's not universally true. It's hard to find universal truths about RMS, as every device has a different implementation. There are also some problems on older Series 40s that appear to relate to record store fragmentation - eventually the phone will reboot and when you restart the app you'll find the record store corrupt. This problem can be avoided by deleting and re-creating the record store. Most devices will not require delete-and-re-create, and the vast majority of deployed applications do not do this. Of course, most deployed applications are games, and just store hiscore, sound on/off setting, and so on - not much data, and often packed in a single record. Delete-and-re-create is worth considering if you're storing a large amount of data, and your data are volatile. Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Thanks for the reply. No universal truths... I should have guessed.
So for Series 60, if there's no specific limit, does that mean it just keeps filling up the record store until it runs out of all the space allocated for total RMS? |
|
Series 60's don't allocated a specific amount for RMS. So far as I know, it's just a file in the Symbian filesystem, so the maximum size is the amount free in the filesystem.
While people have reported problems with 7650s not releasing file-space when records are deleted, I have never seen this problem, so presumably it doesn't happen on newer Series 60s. If you have a Symbian Series 60 file explorer application, you should be able to find the RMS files and see how big they get. Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|