This topic describes how to develop the DB2 Everyplace ISYNC4J for MIDP within
the Sun Wireless Toolkit application. The examples used in this section
are based on the VNurse sample application.
Prerequisites
See Overview of DB2 Everyplace synchronization providers for detailed information on hardware and software
prerequisites for using the DB2 Everyplace J2ME MIDP synchronization
provider.
Procedure
- Launch the Wireless Toolkit. From a command line prompt, change to
the bin directory where the Sun Wireless Toolkit is
installed. Type ktoolbar.bat.
- Note:
- It is recomended to use a command prompt instead of the Windows
Start menu.
- Create a new project for the isync4j sample application:
- Open the J2ME Wireless Toolkit
- Select New Project.
- Type the project name (for example, VNurse)
- Type a MIDlet class name (for example,
com.ibm.mobileservices.demo.VNurse)
- Click Create Project.
- Copy the ISyncMidp.jar file to the J2ME project
library. For example:
c:\>copy %DSYINSTDIR%\Clients\Midp\lib\ISyncMidp.jar \
j2me_install_dir\apps\VNurse\lib.
- Optional: If you want to view the trace output while the MIDlet is
running, copy ISyncMidpDebug.jar to the
j2me_install_dir \apps \VNurse \lib.
- Note:
- Do not use trace when building a JAR file that will be installed on the
phone.The resultant JAR file will be too large to install.
- Optional: To use obfuscation (to reduce the code size), copy the
retroguard.jar file to the bin directory where J2ME is
installed.
- Click Settings . The Settings for project window
opens. Click the User Defined tab and click Add
to type the following Key and Value entries:
- Db2eSyncPassword, nurse1 [default]
- Db2eSyncUserName, nurse1 [default]
- PacketDownSize, 2800 [ default 30000 ]
- PacketUpSize, 1400 [ default 30000]
- Db2eSyncHost, localhost [default]
- Db2eSyncPort, 9080 [default]
These values are placed in the .jad file by the Sun Wireless
Toolkit and the MIDlet reads their values at run time.
- The DB2 Everyplace sample application (VNurse) will display a PNG image
file. Click the MIDlets tab and select
MIDlet-1. Click Edit and change
VNurse.png to ibm.png. You will
need to copy ibm.png from the Midp\samples\images
directory to the J2ME_ install_ dir\apps\VNurse\res
directory.
- Import the DB2 Everyplace sample Java files into the project. For
example, copy the directory structure from %DSYINSTDIR%\Clients \Midp
\samples \com to the J2ME_ install_ dir \apps \VNurse
\src directory.
- Build and run the VNurse sample application. From the Sun Wireless
Toolkit window, click Build and click Run.
Related tasks
Related concepts