Building JDBC for CDC/Foundation

JDBC Optional Package for CDC/Foundation Profile
was released back in 2004. This optional package is required on the CDC platform for any JDBC driver to work. As part of the Reference Implementation download, only source (and documentation) bundle was released. The intent here was that people who have ported CDC platform to their own platform of interest should be able to build JDBC Op Package from this source against the built binary.

The building instructions in the README file of the source bundle are some what vague and there was no clarity on this as CDC platform itself was not Generally Available. Recently, As part of the Open Source effort, mobile and embedded community was formed and CDC platform binaries (for Linux-x86 platform) are now easily available for download, as phoneME Advanced project. With this change, I believe it is more critical to have clarity around building this package.


The steps for Building JDBC Optional Package on phoneME Advanced platform are as below,

1. Download the JDBC Op Package source bundle from here.

2. Download the latest CDC Platform. Please note that currently, this platform is available only on Linux-x86. This means that you will need linux-x86 box to build JDBC Op package as per these instructions.

3. Prepare with JDK 1.4.2 binary. CDC Platform is compliant with JDK 1.4.x spec and so is the JDBC Op Package. You will need JDK 1.4.x 'javac' to build against the CDC.

4. Run following to build the JDBC Op Package.

4.1 cd <JDBC_Source>/cdcfoundation/src/share/jdbc/classes

4.2 <JDK1.4.x>/bin/javac -bootclasspath <CDC_HOME>/lib/<CDC_HOME>/lib/basis.jar -d <pathtoclasses> java/sql/\*.java

4.3 <JDK1.4.x>/bin/javac -bootclasspath <CDC_HOME>/lib/<CDC_HOME>/lib/basis.jar -d javax/sql/\*.java

Here note that, CDC platform contains 'basis.jar' file, as this set of binaries support Personal Basis profile. if you have built your own CDC from the source bundle with profile 'foundation' or 'Personal Profile', you should replace 'basis.jar' file as 'foundation.jar' or 'personal.jar' respectively.

4.4 cd <pathtoclasses>

4.5 <JDK1.4.x>/bin/jar cvf <JDBCOp>.jar java/sql/\*.class javax/sql/\*.class

I am planning to write a simple Makefile for linux-x86 platform which can be used with the JDBC Op package makefiles. Building the entire package will be just one 'make' command then. But, until I get there, this will be helpful, I believe.


added on May 25, 2007.

If you prefer building JDBC Op package along with CDC binary from its svn repository, then you need to add few lines to your makefiles as pointed out by Chris, here.


Late comment, but since I just noticed this post...

First of all, your instructions were very useful to me - good work :)
One minor thing: I believe <pathtoclasses> is missing after the -d in step 4.3.

Also, I tried building the foundation profile of phoneME Advanced, but failed, so I went back to using the default (basis) binaries. If you built this yourself, it would be nice with a blog post on that as well ;)

Posted by John on November 05, 2007 at 11:09 AM IST #

Probably I don't understand all your instructions but when I try to build the JDBC Op Pack, javac give me this message:

Fatal Error: Unable to locate package java.lang in classpath or bootclasspath

I called javac with this command:

C:/j2sdk1.4.2_16/bin/javac -bootclasspath C:/cdchome/lib/ -d java/sql/\*.java

I don't know where is the error...
Someone can help me?

Thak you!

Posted by Tom on March 10, 2008 at 08:42 PM IST #

Sorry to bother you but I've downloaded the CDC profile and the jdbc OP packages and tried to follow your instructions. However the only part I'm missing is what the <pathtoclasses> refers to. I know -d is a reference to a directory but what classes are we dealing with here?

I've absolutely no idea and will be glad to hear a response to this.

Posted by Edem on April 02, 2008 at 01:36 PM IST #

Edem: Run javac without arguments and you will see that <pathtoclasses> (the argument of the -d option) is "Specify where to place generated class files"

Posted by John on April 02, 2008 at 05:22 PM IST #

I am trying to do a thing what NetBeans 5.5 does.
Whenever a driver class is provided to NetBeans to connect to a database it automatically finds out the proper Driver class and the URL pattern.
I want to do it as NetBeans does.

So please lead me to a feasible direction.

Debasis Jana

Posted by Debasis Jana on April 16, 2008 at 05:41 AM IST #

@Tom: On Windows you need to separate the parts of the path with a semicolon, not a colon. As colons are part of the drive names this would cause confusion.


Posted by Daniel Schneller on May 08, 2008 at 06:50 PM IST #

For lazy people like me who do not want to download the reference source and build the jdbc.jar (jsr169) from scratch you can obtain an implementation within Oracle Lite distribution named

There is probably other easier to get to ready made jdbc.jar's out there but I couldn't find one. Cheers.

Posted by Paul French on October 02, 2008 at 01:59 PM IST #

I´m triyng to use jdbc_cdc1.0 in NetBeans 6.5.1. But I dont get it work. Could someone tell me how to do it?

Posted by Angela Rodriguez on July 07, 2009 at 06:20 PM IST #


In your Netbeans project properties, if your CDC VM is properly configured to run via netbeans, you can try adding the bootclasspath as a VM parameter in the "Run" category. Not sure if it will work, though.

See for an example bootclasspath.

Posted by John on July 08, 2009 at 05:45 AM IST #

What if I want to follow the same steps in Windows?? I need to solve the same problem but I work on Windows.

Posted by Angela Rodriguez on August 27, 2009 at 08:33 PM IST #

(1)my platform is WindowsXP and using Netbeans6.7.1 Mobility pack. I have build JSR169 and Derby10.5.3.0 ( using JDK 1.5.20 (becuase 1.6 compiled class does not work in NetBean6.7.1 Mobility environment)
(2)copied derby.jar,derbytools.jar,jsr169.jar under C:\\java\\netbeans6.7.1\\mobility8\\Java_ME_platform_SDK_3.0\\runtimes\\cdc-hi\\lib\\ext
(3)VM argument
permission java.lang.RuntimePermission "";
permission java.lang.RuntimePermission "";
(5)Compiled sample application in NetBeans with -source 1.5 -target 1.5

But still getting error java.lang.SecurityException: Prohibited package name: java.sql

anyone have suggestions ?

Posted by Pragun on August 28, 2009 at 12:28 PM IST #

Thank you.Hot Shoes Cheap Jordan shoes michael jordan shoes and are on sale-Free shipping.

Posted by michael jordan shoes on January 11, 2010 at 12:21 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed



« July 2016

No bookmarks in folder