Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can I have a database in J2ME, since there is no SQL???

 
Roberto Rangel
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I need to create a RELATIONAL database in J2ME but I was told there is no SQL in J2ME and that I should use XML to store data. Is this the best way? I need to store the data in the device, so it doesn't connect to any server or anything like that.

Does anybody know how to do this?

Much appreciated,
Roberto
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You were told wrong. I'm pretty sure that there's a version of IBM's DB2 UDB that's specifically designed for mobile devices. Nor is it the only SQL DBMS for mobiles. There's also a number of non-SQL DBMS's suitable for lightweight systems if you don't need the full feature set of SQL.
 
ramzi ghaith
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think that you can use the Records Store in
javax.microedition.rms.RecordStore package

example: RecordStore.openRecordStore("Database Name",true);

then you can add new records on the records store.

for more info see : http://www.enoughsoftware.com/javadoc/j2me/index.html
 
Sukitha R Udugamasooriya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah as Ramzi told you can use Records Store for the persistence storage for mobile devices. And it is very easy. But since your requirement is to have "relational characteristics" to your database, Tim's suggestions are very good. But still it depends on your requirement.
All the best
3 cheers JavaRanch
 
Albert Kam
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, i understand the difficulty in finding the j2me database solutions. I've found out what works best now for my CDC app, which is the Apache Derby. As far as i can see, it's free and it works :-)

It can be embedded and supports CDC profile.

EmbeddedSimpleDataSource is Derby's DataSource implementation for J2ME/CDC/Foundation. It is also supports J2SE platforms. Supports the same properties as EmbeddedDataSource, see that class for details.

EmbeddedSimpleDataSource automatically supports the correct JDBC specification version for the Java Virtual Machine's environment.

* JDBC Optional Package for CDC/Foundation Profile(JSR-169) - J2ME - CDC/Foundation


Quoted from this page

Also, i found out about JDBM which stores java objects and have the atomic transaction feature. I read others say about hsqldb that works great (although i ended up with failures when trying hsqldb with IBM J9)

Anyway, please share other solutions which works for you :-)

Regards,
Albert Kam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic