• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 28250
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic