Embedded J2ME database on N95
March 23, 2008 9:00 AM   Subscribe

How to get a relational database on a mobile device, and query it using J2ME?

Hi. I've trawled and scoured, but I'm missing something reeeaaal basic :)

I've got an N95. I'm writing a Java microedition program for it using Netbeans. All fine so far. However, I'd really like a relational database to power this program.

I suspect that I need to be using pointbase embedded or micro, but I'm not sure.

Ideally I'd seed the database with the data and relationships, build and test the application using Netbeans IDE and device simulator, then upload both to the N95. The app is a multiple choice quiz, and the data contains some relationships that would be soooo much simpler to model in an RDBMS than raw Java objects.

I appreciate this is probably very straightforward, like I say, I'm struggling to work out exactly what I need to do :-|

And if anyone has experience of developing apps with embedded RDBMS for N95 using Netbeans... let me know any tips :-)

Much obliged.
posted by ajp to Computers & Internet (5 answers total)
 
You could use a RecordStore, and have the comparators use unique IDs to find the relevant answers for the questions. It's ugly, though, and requires detokenizing strings and whatnot. I suspect this isn't what you want. I'm used to working at a very place that hated to spend money and this is the kind of thing I did all the time. It's not as bad as a flat file, just a little bit harder to write the queries to get the data out.

But... it isn't that complicated, is it? A question has many answers, a question has one correct answer, a question has one answer given per user. Not a complicated database, should be easily emulated in a RecordStore.

I found an open source J2ME database, but that was from a 'J2ME database' query to google, so I'm sure you know about it.

Tips? I use gVim and ant, so sorry. General tip, though: If you're having performance issues, read this performance guide from Google for Android. Brilliantly written, that article was. It's not specifically for J2ME, but it is written for Java and the Computer Science concepts are sound and valid.
posted by sleslie at 9:46 AM on March 23, 2008


Keep in mind that "Perst" is licensed under the General Public License. This means you more likely need to provide the source code to your entire application if you use it and distribute your application. You can also buy a commercial license for Perst if that is unacceptable for your purposes.
posted by bottlebrushtree at 11:08 AM on March 23, 2008


Response by poster: Hmm. I've discovered that Netbeans comes with Apache's derby Java database bundled with it, so I'm using that instead of pointbase or perst.

However, I can't get the thing to work. I've followed the instructions on creating a database and adding tables, and that's all fine. But I just can't work out how to actually write code to connect to it! The obvious step would be "import org.apache.derby.*;" but Netbeans tells me "org.apache.derby does not exist".... even when its derby plug-in can create and manipulate databases quite happily! I've been adding folders and jar files to the "project properties" like there's no tomorrow.... and the Netbeans GUI autocompletes the "import ..." statements while I'm typing them, but still tells me "does not exist".

I'm going nuts.

There must be some real basic thing I'm missing here, something to do with classpaths or *something*.... but I've no idea :-( Everything I've turned up on the net is about the Netbeans plug-in rather than actually accessing the database.

Stumped!
posted by ajp at 1:36 PM on March 23, 2008


Response by poster: Oops, links:

Derby database: http://db.apache.org/

Instructions on creating the database: http://www.netbeans.org/kb/60/ide/java-db.html
posted by ajp at 1:38 PM on March 23, 2008


Wait... doesn't the N95 use a recent version of Symbian? That means that SQLite is probably included, no? It might not be as tight with NetBeans, but it is good in almost every way (stable, fast, tiny...)
posted by tmcw at 6:51 PM on March 23, 2008


« Older Engagement ring on or off?   |   How to request a reference? Newer »
This thread is closed to new comments.