This blog is just one part of our series about Netweaver Mobile 7.1. The available blogs in this series are:
- [Visualizing database content of the NWMobile PDA client (part 2) | What you ever wanted to know about pda development in mobile 7.1 (part 2)]
- [Autologon on the NW Mobile PDA client (part 3) | What you ever wanted to know about pda development in mobile 7.1 (part 3)]
- [Accessing the client database via jdbc (part 4) | What you ever wanted to know about pda development in mobile 7.1 (part 4)]
If you are using Netweaver Mobile 7.1 to develop and especially test your windows mobile application on PDA, you already might have had the feeling of unsureness about the content of your database tables. This could be caused due to a bug in your application and the interaction with the client persistency layer or an issue during synchronization. So, If you are one of these developers, you also might have asked the question: how can I debug into the database and take a look at the content of the tables? The good answer is that this is actually quite simple. The necessary steps will be explained in this blog. It is possible to access both the database of a client for the win32 simulator as well as a database coming from a physical pda device (windows mobile client). In general, you can use any jdbc-compatible database viewer. In this blog, I will use a tool called “DbVisualizer” which is available for free. It allows you connecting to a jdbc-compatible database and browse the existing database tables, their content and even executing sql-statements.
The pda client which is included in Netweaver Mobile 7.1 by default uses the mindDB database for the persistency of configuration data and data of the Data Objects. MinDB is a database system developed by SAP with a small memory footprint. It is especially meant to run on mobile devices like pdas. The Netweaver Mobile 7.1 pda client also supports IBM DB2e, but you have to purchase this separately directly from IBM. The shipment of Netweaver Mobile does not include it, but only minDB. But anyways this blog will handle both cases using mindDB as well as DB2e.
- At least JDK 1.5 should be installed on your system
- If you want to access the database content of a windows mobile client (not the win32 simulator), you should copy the folder “/MI/data” to a folder on your hard disc. You can use Active Sync to access the filesystem of the device
h2. Configure the tool
*Note: *The following instructions apply to both DB2e and minDB. Some of the steps are marked with either or . This means that this specific step is only necessary for one of the specific database types.
1) Download and install the “DbVisualizer” from here [[http://www.dbvis.com/products/dbvis/download/ | http://www.dbvis.com/products/dbvis/download/]]. Don´t use the latest version. I faced some issues with it. For me the versions 4.3.6 and earlier worked fine.
2) Now you have to register the jdbc driver for minDB. This has to be done in the “Driver Manager” area. In the menu navigate to “Tools -> Driver Manager”.
3 ) In the displayed dialog, add a new entry and call it “minDB”. Specify an URL format like “jdbc:embeddedMinDB://?minDB=3 ) In the displayed dialog, add a new entry and call it “DB2e”. Specify an URL format like “jdbc:db2e:5 ) Back in the main window, open the menu “Tools -> Tool properties” and navigate to “SQL -> SQL statements”. DbVisualizer uses a set of SQL statement templates to browse the database content. The default templates are not working with minDB. For each of the templates, you have to removed the phrase “$$schema$$$$schemaseparator$$”. For example, the template SELECT ALL should look like “select * from $$table$$”.
5 ) The three dlls “CryptoPlugin.dll”, “DB2e.dll” and “DB2eJDBC.dll” have to be made available on the system path in windows. This can either be done by copying the files to the “…/windows/system32” folder or by putting the folder which contains the files to the environment variable “PATH”. Please restart “DbVisualizer”.
Now the tool is configured properly and you are able to connect to your database.
h2. Connecting to the db
1 ) In the main window of DbVisualizer, add a new connection (without using the wizard). Select the driver “minDB” and specify the URL “jdbc:embeddedMinDB://?minDB=c:MIdata”. Here, you have to replace “c:midata” by your local settings. The folder you are pointing to can either be the db folder of a win32 simulator (shipped along with the NWDS) or a folder you copied from a windows mobile device to your local disc. As user name and password you should enter “dba” for both (unless you changed this yourself in the client configuration).
1 ) In the main window of DbVisualizer, add a new connection (without using the wizard). Select the driver “DB2e” and specify the URL “jdbc:db2e:c:/MI/data/”. Here, you have to replace “c:midata” by your local settings. Please note that the slash at the end of the folder is mandatory. As user name and password you should enter “dba” for both (unless you changed this yourself in the client configuration).
2) Press on “Connect” and wait until the initializing is finished.
3) On the left hand side, you should now be able to browse through all the database. Clicking on one table, will open the editor for this table allowing you to view the structure and content.
We feel that it is very helpful and powerful for developers to have the knowledge about the content of the database. It can dramatically simplify the development and verification of your application. But it can be used as well during support of your end users if they face issues with your application during usage. If you think the steps can be simplified or are not working for you, please share this with us.