BUG Community

Welcome! Log In

JOcanto's Blog

BUG + MySQL + openJDK-cacao

created on: 08/19/09Developing database applications for the Bug Platform can be challenging, mostly because phoneME doesn't support JDBC. A viable solution to this problem might be installing a different JVM, one which supports JDBC, like cacao or openJDK. However, like almost any solution in the computer world, nothing comes for free; by switching phoneME for cacao or openJDK you'll sacrifice speed in order to gain more functionalities (see kschultz JVM Comparison post).

Recently, I wrote an app that uses openJDK+cacao and connects to a MySQL database. If you want to try it out , here are the steps you need to take. They are not hard but rather tedious.

Setup Dragonfly

First, we need to set up Dragonfly

  1. Open Dragonfly.
  2. Create a new Bug Application. File->New->Other->Bug Application
  3. Right click on the project and select Properties->Java Build Path->Libraries
  4. Remove PhoneME Personal Library.
  5. Then, press  Add Library..., select JRE System Library and click Next, choose a JRE, press Finish, and then press OK.
  6. Create a folder call lib within the project directory [WORKSPACE_PATH]/[YOUR_APP_NAME]/lib
  7. Download Connector/J 5.1 , extract the mysql-connector-java-5.1.7-bin.jar file and place it in the recently created /lib folder
  8. Finally, add the following line to your Manifest file
  9. Bundle-ClassPath: .,lib/mysql-connector-java-5.1.7-bin.jar

Now, you can use JDBC to write an application that connects to a MySQL database.

Install opendJDK+Cacao

By default, the bug comes with phoneME. Good thing that the team here at BugLabs has done some work to port openJDK+Cacao to the Bug. So, you just need to install the new JVM and configure concierge to use it.

  1. First, download these files: cacao-openjdk_0.99.4-r0_armv6.ipk, openjdk-6-cacao-jre_6b16-r2_armv6.ipk
  2. Transfer the files to your BUG:
  3. $ scp *.ipk root@10.10.10.10:/home/root
  4. Log into your bug
  5. $ ssh root@10.10.10.10 root@10.10.10.10's password: ...
  6. Then, install the packages
  7. $ ipkg install cacao-openjdk_0.99.4-r0_armv6.ipk ... $ ipkg install openjdk-6-cacao-jre_6b16-r2_armv6.ipk ...
  8. The next step is to tell concierge to use the new JVM. Open the start.sh file
  9. $ vi /usr/share/java/start.sh and chage the class path # CVM_DIR=/usr/lib/jvm/phoneme-advanced-personal-debug # CVM_PATH=/usr/bin/java-cdc # CVM_PARAMS= CVM_DIR= /usr/lib/jvm/java-6-cacao CVM_PATH=/usr/bin/java CVM_PARAMS=
  10. Restart concierge,
  11. $ /etc/inti.d/concierge restart ... and you should have concierge running on top openJDK+cacao.
Install MySQL

Next, we are going to install MySQL server and client into your bug:

  1. First, download the packages (you can always build them yourself): libmysqlclient14_4.1.18-r3_armv6.ipk, mysql-server_4.1.18-r3_armv6.ipk, mysql-client_4.1.18-r3_armv6.ipk
  2. Transfer the packages to your BUG from terminal, shell or any other SCP program:
  3. $ scp *.ipk root@10.10.10.10:/home/root
  4. Log into your bug and install the packages:
  5. $ ssh root@10.10.10.10 root@10.10.10.10's password: ... $ ipkg install libmysqlclient14_4.1.18-r3_armv6.ipk ... $ ipkg install mysql-server_4.1.18-r3_armv6.ipk ... $ ipkg install mysql-client_4.1.18-r3_armv6.ipk ...
  6. We need to make one more change before start the server. MySQL needs write permission of the /var/run folder
  7. $ chmod 757 /var/run unfortunately this is just a temporally solution, because the /var/run folder is volatile (non persistent) ,so, every time you reboot your bug you will have to change the permission of the folder. A way around this problem is to change the default permission of the /var/run folder when is created. We can do this by # Open this file $ vi /etc/default/volatiles/00_core # and change the following line from d root root 0755 /var/run # to d root root 0757 /var/run Now every time the bug is started the /var/run folder has write permission.
  8. To start the server just type
  9. $ /etc/init.d/mysqld start
  10. If you want MySQL to start at boot time, just make a symlink from your run-level directory
  11. # S50 tells the system to start mysql when it boots up $ ln -s /etc/init.d/mysqld /etc/rc.d/rc5.d/S50mysqld # K50 tells the system to stop mysql when it shuts down. $ ln -s /etc/init.d/mysqld /etc/rc.d/rc5.d/K50mysqld

 

That's it, you are ready to create and run database apps on the Bug. If you have any question or problem, just jump into the IRC channel or email me.

Post Comments

Add Your Comment!

 

nike air max  http://www.nike-nike.com

nike air max 90  http://www.nike-nike.com

nike air max shoes  http://www.nike-nike.com

 

MBT shoes  http://www.mbtshoes.cc

anti shoes  http://www.mbtshoes.cc

cheap mbt  http://www.mbtshoes.cc

 

coach bags  http://www.coachonsale.net 

coach outlet  http://www.coachonsale.net

coach outlet store online  http://www.coachonsale.net

 

chanel bags  http://www.chanels.cc

chanel online  http://www.chanels.cc

chanel handbags http://www.chanels.cc

 

louis vuitton bags  http://www.uselv.com

LV handbags   http://www.uselv.com

louis vuitton outlet  http://www.uselv.com

 

coach outlet  http://www.coachs.cc

coach outlet store online  http://www.coachs.cc

coach handbags  http://www.coachs.cc

I recently to visit your blog, reading, I very much enjoy, and above the content is great.

 

 

nike air max  http://www.nike-nike.com

nike air max 90  http://www.nike-nike.com

nike air max shoes  http://www.nike-nike.com

 

MBT shoes  http://www.mbtshoes.cc

anti shoes  http://www.mbtshoes.cc

cheap mbt  http://www.mbtshoes.cc

 

coach bags  http://www.coachonsale.net 

coach outlet  http://www.coachonsale.net

coach outlet store online  http://www.coachonsale.net

 

chanel bags  http://www.chanels.cc

chanel online  http://www.chanels.cc

chanel handbags http://www.chanels.cc

 

louis vuitton bags  http://www.uselv.com

LV handbags   http://www.uselv.com

louis vuitton outlet  http://www.uselv.com

 

coach outlet  http://www.coachs.cc

coach outlet store online  http://www.coachs.cc

coach handbags  http://www.coachs.cc

I recently to visit your blog, reading, I very much enjoy, and above the content is great.

 

 

nike air max  http://www.nike-nike.com

nike air max 90  http://www.nike-nike.com

nike air max shoes  http://www.nike-nike.com

 

MBT shoes  http://www.mbtshoes.cc

anti shoes  http://www.mbtshoes.cc

cheap mbt  http://www.mbtshoes.cc

 

coach bags  http://www.coachonsale.net 

coach outlet  http://www.coachonsale.net

coach outlet store online  http://www.coachonsale.net

 

chanel bags  http://www.chanels.cc

chanel online  http://www.chanels.cc

chanel handbags http://www.chanels.cc

 

louis vuitton bags  http://www.uselv.com

LV handbags   http://www.uselv.com

louis vuitton outlet  http://www.uselv.com

 

coach outlet  http://www.coachs.cc

coach outlet store online  http://www.coachs.cc

coach handbags  http://www.coachs.cc

I recently to visit your blog, reading, I very much enjoy, and above the content is great.

 

 

nike air max  http://www.nike-nike.com

nike air max 90  http://www.nike-nike.com

nike air max shoes  http://www.nike-nike.com

 

MBT shoes  http://www.mbtshoes.cc

anti shoes  http://www.mbtshoes.cc

cheap mbt  http://www.mbtshoes.cc

 

coach bags  http://www.coachonsale.net 

coach outlet  http://www.coachonsale.net

coach outlet store online  http://www.coachonsale.net

 

chanel bags  http://www.chanels.cc

chanel online  http://www.chanels.cc

chanel handbags http://www.chanels.cc

 

louis vuitton bags  http://www.uselv.com

LV handbags   http://www.uselv.com

louis vuitton outlet  http://www.uselv.com

 

coach outlet  http://www.coachs.cc

coach outlet store online  http://www.coachs.cc

coach handbags  http://www.coachs.cc

I recently to visit your blog, reading, I very much enjoy, and above the content is great.

 

 

nike air max  http://www.nike-nike.com

nike air max 90  http://www.nike-nike.com

nike air max shoes  http://www.nike-nike.com

 

MBT shoes  http://www.mbtshoes.cc

anti shoes  http://www.mbtshoes.cc

cheap mbt  http://www.mbtshoes.cc

 

coach bags  http://www.coachonsale.net 

coach outlet  http://www.coachonsale.net

coach outlet store online  http://www.coachonsale.net

 

chanel bags  http://www.chanels.cc

chanel online  http://www.chanels.cc

chanel handbags http://www.chanels.cc

 

louis vuitton bags  http://www.uselv.com

LV handbags   http://www.uselv.com

louis vuitton outlet  http://www.uselv.com

 

coach outlet  http://www.coachs.cc

coach outlet store online  http://www.coachs.cc

coach handbags  http://www.coachs.cc

I recently to visit your blog, reading, I very much enjoy, and above the content is great.

 

 

nike air max  http://www.nike-nike.com

nike air max 90  http://www.nike-nike.com

nike air max shoes  http://www.nike-nike.com

 

MBT shoes  http://www.mbtshoes.cc

anti shoes  http://www.mbtshoes.cc

cheap mbt  http://www.mbtshoes.cc

 

coach bags  http://www.coachonsale.net 

coach outlet  http://www.coachonsale.net

coach outlet store online  http://www.coachonsale.net

 

chanel bags  http://www.chanels.cc

chanel online  http://www.chanels.cc

chanel handbags http://www.chanels.cc

 

louis vuitton bags  http://www.uselv.com

LV handbags   http://www.uselv.com

louis vuitton outlet  http://www.uselv.com

 

coach outlet  http://www.coachs.cc

coach outlet store online  http://www.coachs.cc

coach handbags  http://www.coachs.cc

I recently to visit your blog, reading, I very much enjoy, and above the content is great.

 

Would it be easier or more appropriate to use SQLite instead of MySQL on BUG?  I can see the potential utility for a BUG app to connect to a remote MySQL server, but if you're storing data on BUG, MySQL sees like extra overhead..

 

Right now there is no app at BugNet, but I think I'll post one soon.

This is great Irvin! How do you run SQL queries from BUG app?? Is there any sample apps on BUGnet?

» All comments
» Comments RSS

Powered by Community Engine

Top
Login
Close
Bottom