Thursday Nov 29, 2007

Apache Derby now tested with phoneME advanced

Apache Derby is now tested with the open source JavaME CDC stack, popularly known as phoneME advanced platform. The Apache derby community recently carried out this exercise and it did not take them long to flag GREEN.

So, Try Apache derby on phoneME advanced !

For more information on the Java ME support, please follow the Apache Derby Wiki page.
 

Friday May 25, 2007

JavaDB on JavaME platform

As the consumer devices get more sophisticated, more complicated applications will run on devices and there will be greater need to manage the application data. The need for running database engine on small devices will thus be very critical.

JavaDB, a cost effective, easy to use, fully featured, pure Java database with a very small footprint (2MB), looks very promising  on small devices. I tried running it on the latest phoneME advanced (JavaME CDC) platform and could not resist the excitement of putting the details together in this blog. The procedure is very straight forward.

Prepare your setup as below, 

1. Get the latest phoneME advanced platform. Currently, it is supported only on Linux-x86 platform.
2. Get the latest JavaDB release.
3. You also need the JDBC Optional package library for CDC platform. It can be built from the source using the step by step instructions.

Now, try following on your linux box,

<CDC_HOME>/bin/cvm -Xbootclasspath/a:<JDBC_OP>/foundation_jdbc.jar 
-cp <JAVADB_HOME>/lib/derby.jar:<JAVADB_HOME>/lib/derbytools.jar
-Dij.dataSource=org.apache.derby.jdbc.EmbeddedSimpleDataSource
-Dij.dataSource.databaseName=sample
-Dij.dataSource.createDatabase=create
org.apache.derby.tools.ij

Note here that the JDBC Op package can also be built along with CDC binaries, as mentioned here. then, Xbootclasspath need not be specifed while running. By default, the CDC build does not include JDBC Op package, hence we include it in our example.

Please note that, JSR 169, The JDBC Optional package does not support java.sql.Driver. So, the 'ij' cannot be used in its typical form to connect to database via a JDBC driver. The connection in this case is established using the JDBC DataSource.

This will bring up the íj prompt. 'ij' provides Command Line Interface to interact with a database using SQL. You may create such connection directly from your ME application using DataSource objects. You can try some simple steps like below to further test this setup.

ij> create table t (id int not null, addr varchar(20));
0 rows inserted/updated/deleted
ij> insert into t values (1, 'PlanetSun');
1 row inserted/updated/deleted
ij> select \* from t;
ID         |ADDR                
--------------------------------
1          |PlanetSun           
1 row selected
ij> exit;


Any database that may have been created by desktop Java application can be read/modified on JavaME platform and the same database can be used by the desktop application again. This can be accomplished so easily only with Java-JavaDB combination!

About

user13377336

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
Blogroll

No bookmarks in folder