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.
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.
An IDE is no substitute for an Intelligent Developer.
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
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.
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 :-)