Skip to main content

Database for EAV model

8 replies [Last post]
public2public
Offline
Joined: 2007-07-18
Points: 0

Good Day!

I'm making a midlet that incorporates a database system with relatively large records (~10,000 patient records on an EAV [entity-attribute-value] model).

I suppose RMS cannot do or "is not fit" for this job. (at least, efficiently)

Can i use the OpenBaseMovil for this purpose?
or Perst Lite maybe?

Please give an opinion to my problem.
Thank you.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
abbasvlb85
Offline
Joined: 2009-01-07
Points: 0

Sir, i am developing a mobile library.(SD card contain books as jar file).. to achive security,i need to store a data(only one record) in persistant storage(SD card)..

By using file concept i tried to write any text file present inside SD card,in J2me its not possible i think...

i dont want RMS, because i want to store the data in SD card and the data must be able to access by all the other jar files...

Now i am looking for Database to accomplish that..

please help me.. which DB i can used inside mobile to store the data..

send some usefull links sir,..

Thank u sir..

sfitzjava
Offline
Joined: 2003-06-15
Points: 0

The PIM API has a FileConnection set of classes that will allow you to write and read from the SD in most phones. However you may need your app signed and you must have your jad file permissions set to request PIM and Filesystem read/write access.

Also you may need to place your files in certain locations on the SD, and will have to determine how the device lists the SD for access. Some devices follow the DOS style of A: C: for drive letters, other use named locations "Phone Memory" "mmc" etc..
You will use something like:
FileConnection fc = Connector.open("file:///Other/myfile.txt")
to open your file, and using the GCF you can get the input/output streams and access
your files.

Google for 'j2me fileconnection example" and you should find some tutorials like this one:
http://developers.sun.com/mobility/apis/articles/fileconnection/

-Shawn

>
> By using file concept i tried to write any text file
> present inside SD card,in J2me its not possible i
> think...
>

abbasvlb85
Offline
Joined: 2009-01-07
Points: 0

Thank u for u r response...

wat happen if i try to write a file with out signing the MIDlet...?
i thought it will ask the user to give permission to write..(yes or no type question) and application will run.. is it right?

Here i my code:
public void store(String imei){
try{
FileConnection fc=(FileConnection)Connector.open("file:///E:/book.txt",Connector.READ_WRITE);
if(!fc.exists()){
fc.create();}
OutputStream op=fc.openOutputStream();
byte[] b =imei.getBytes();
op.write(b);
op.close();
disp.setCurrent(textBox);
}catch(NullPointerException ex){
textBox.setString("nulll");}
catch(Exception ex){
textBox.setString(ex.toString());
}disp.setCurrent(textBox);}

if i run this code in 3110c jsr75 supported ,it displaying "application set to not allowed"
if i press ok..it throwing java.lang.SecurityException..

wat is the prob?

help me..

sfitzjava
Offline
Joined: 2003-06-15
Points: 0

It depends on where you are trying to place the file.

I often get the security error on new devices. It takes some testing to find out where they will allow you to place files. Sometimes placing them into an "Other" directory works, or making your own directory sometimes fixes it. It all depends on the device/OS/JVM implementation.

On the Nokia 3110c you might try making your own directory first then writing the file into it.
Looking at some of my code that appears to be how I make it work. However I also have a verisign cert and sign my apps.

-Shawn

terrencebarr
Offline
Joined: 2004-03-04
Points: 0

Hi again,

Don't worry about your English - it is just fine!

Your application is interesting (rural community health care) ... I'd be interested in hearing how your project progresses. Maybe you even want to turn it into an open source project?

To answer your questions:

You are correct that RMS is limited on many platforms - also, performance can vary widely. But when you talk about "really huge records" for your application and say that 1 MB (on S40 devices) is not enough I am wondering if you will be able to process that amount of data on a low-end to mid-range phone even if you could store it. So the capability of the database may not be the limiting factor.

As for Perst/PerstLite - I am not an expert in it - you may want to contact the McObject people directly, I've found them to be quite helpful.

As you say JSR-75 is another option - if your requirements in terms of relational functionality are not too high then you could certainly create your own little flat-file database with a space-saving binary representation, indexing and caching. But watch out for file access times which can be long on devices that use non-volatile memory for file storage.

SQL versions such as JavaDB typically require CDC-based platforms because they need Java SE-type language features and APIs. However, I found this

http://developer.mimer.com/documentation/latest_javadoc_midp/overview-su...

which seems to be an SQL driver on CLDC/MIDP - but you will still need the actually SQL implementation underneath.

Finally, I think you may need to rethink your design. If the database is really that large you may want to offload the queries and processing to the server and just provide the UI and the results on the phone - this of course requires decent wireless connectivity and cost is a factor. I don't know if that is an option in your case.

-- Terrence

public2public
Offline
Joined: 2007-07-18
Points: 0

Thanks again for your reply and for the comments. :)

Please bear again to the long reply….
{the story behind the project (: )

Actually, the project is based from an open source code, so, probably (and hopefully), if our group (we are 3 college students) will finished it, it would be integrated into the original one:
http://code.google.com/p/chits-ph/

The current project is a LAMP-based running on an intranet set-up in a rural health center:
[b]
desktop/workstation(health center)<-------------{intranet}-------------->server(health center)[/b]

However, many of the data/information comes from the remote area (far away from the center) and rural health workers who collect the data just jot down it temporarily on a paper and latter encode it into the workstations(workers visit the center at least once a week). This method is obviously erroneous and irksome.

So our task is to provide a mobile interface of the application.
And as you have suggested, the most efficient/easiest way is by connecting the mobile phone to the server via wireless HTTP protocol.
So the model 1 is supposed to look like this:

[b]workstations(center)< ----------{intranet}---------->server(center) <----------{WAP}---------->phone(remote area)[/b]

But the “great” technological cost hindered this set-up. Present locations (rural centers) where the project was deployed don’t have any internet connection and the installation/maintenance of it is relatively expensive (the doctor said it’s not really possible for rural areas, not at these present times).

So our next model is to utilize SMS messaging (which is very popular here in the Philippines) to query/update the data from server.
Model2:
[b]
workstations(center) <----------{intranet}---------->server(center) <----------{GSM}---------->phone(remote area)[/b]

But then again, even this greatly cheaper set-up (unlimited SMS messaging/”texting” in this country would cost only ~0.50$ a day) was not agreed to be effective, again, due to its expected “accumulative high cost”. (As you could see, developing countries barely prioritize health concerns of the public)

So the final resort is to make a low or no maintenance cost set-up. Thus came the “strange” idea of storing the whole database on the phone. For this method, the health workers obtain the updated/latest copy of the database for their work in the remote area, and as they will return into the center (once a week), the data gathered/edited is synchronized/updated into the database server and their copy of the database is also updated (along with the updates from the center and from workers in different remote areas).
Model 3:

[b] workstations(center) <-------{intranet}------>server(center) <--------{Bluetooth}------->phone(center after a week in remote area)[/b]

The doctor even suggested the elimination of the workstations in the health center by substituting them with mobile phones. He believes that this set-up will cut the cost of installing the project in a rural area.

Model xxx:

[b]phones(static in center) <------{Bluetooth}----->server(center) <-------{Bluetooth}------>phone(center after a week in remote area)[/b]

So that’s the long story of our project. :)
In the past, the problem is the cost. Now, the performance and even the attainability of the set-up.

p.s. MIDlet would connect into a Java swing interface in the server that communicate to the present MySQL database

Message was edited by: public2public

terrencebarr
Offline
Joined: 2004-03-04
Points: 0

There are a couple of options. Please see my blog:

http://weblogs.java.net/blog/terrencebarr/archive/2007/12/databases_for_...

The fundamental question is: WHat is your platform (CLDC/MIDP or CDC)? That determines some of the database choices you can make.

-- Terrence

public2public
Offline
Joined: 2007-07-18
Points: 0

> There are a couple of options. Please see my blog:
>
>
> ttp://weblogs.java.net/blog/terrencebarr/archive/2007/
> 12/databases_for_y.html
>
> The fundamental question is: WHat is your platform
> (CLDC/MIDP or CDC)? That determines some of the
> database choices you can make.
>
> -- Terrence

Thanks for your reply and great link!
The targeted platform would be CLDC/MIDP and it would be deployed on mobile phones.

But here are my problems (please bear to read :) ):

#1. Most of the API's (OpenBaseMovil, Perst Lite (rms), Floggy and J2MicroDB) are based on the RMS (Record Store) of the J2ME. But I found out that the RecordStore's maximum size varies for each phone and most are limited to ~1MB (e.g. Nokia S40 devices). As you've noticed, the records that I'm expecting to handle are really huge and I must store them in only one table (EAV model). I doubt if "simple Java-enabled phones" can allow this amount of bulk/size. (though, I [b]must still[/b] try it).

#2. My second option is to use a file-based database. And the Perst-jsr75 is the only one that I've found. The problem is : I haven't seen even a single example using this API. The only example I've found out for Perst Lite is the ProScout/Basketball project (that you've also mentioned in one of your blog (: ) but I believe it uses the perst-rms and not the perst-jsr75 API/jar.

#3. My other option is to use the SQLite. But then again, I haven't seen any manual/guide that shows how to install/embed this one(SQLite) on a mobile phone. I'm also not sure if it's possible to use, because as far as I know (not so far), there is no JDBC API available yet for CLDC/MIDP platform.

and #4. And my last resort, I believe, is to store the data/records on a 'flat' or an xml file. And I assume this is gonna be a daunting task (both for me and the running device).!

Sorry for a lengthy reply and hoping for your reply (:...

(p.s. I've mentioned "simple Java-enabled phones", because the application will be (hopefully) deployed on[b] rural community health centers[/b] here in the Philippines and the cost of the phone is highly considered. Also, the doctor suggest that the cellular phone must act like a simple desktop computer which denotes the large database to be stored/maintained. Lastly, sorry for my 'quite' troublesome English (: )

Message was edited by: public2public