I am working under KDE community and my GSoC project is Add support for importing tables from LibreOffice Base to Kexi. My mentor for this project is Kexi maintainer and developer Jaroslaw Staniek. Here is the brief overview about this project and my current status in this project.
Kexi is an open source visual database creator. In kexi we can create database applications and perform queries. It also provides functionality to import database from other database sources. Currently kexi needs to add support to import database tables from odb files generated by LibreOffice Base. It is very important to have this functionality for kexi as more and more open source users are shifting to kexi. So, my task is to enable database migration from LibreOffice Base to Kexi.
My agenda is to implement classes which will enable database migration from .odb format to kexi. The main thing to note here is .odb format stores data in HSQLDB database format. There is not any functionality available to read hsqldb files from cpp code of Kexi and then migrate to kexi database. So, I have to use JDBC driver provided by HSQLDB project, that can be used in Java code.After that I am using Java Native Interface (JNI) to get database data and structure in cpp code. I have implemented a java class which will read the data from the .odb format and have to call my java methods from my C++ program using JNI. The java program consists of database connection method to connect to HSQLDB. A little idea about how I connect to HSQLDB:
public void connectDatabase()
con = DriverManager.getConnection( “jdbc:hsqldb:file:”+ path to directory+file name,”SA”, “” );
I call this driver connection method from my C++ code. For example,
jclass clss = env->FindClass(<class_name>);
jmethodID method = env->GetMethodID(clss, “<init>”, “()V”);
jobject object = env->NewObject(clss, method);
method = env->GetMethodID(clsH, “connectDatabase”, “()V”);
However, we have to set lots of things to implement JNI. But this was a little overview about how we can make an object and call the method of Java class from cpp code.
This task is little bit complex as we have to set environment variables, link libraries to compile Java as well as C++ files. I have compiled my code independently and it is running successfully. So, right now I am working on settings these things in cmake files to compile with the whole kexi project.
I have added .desktop file, through which migration driver will loop up all the drivers and gives options of the import table types. It is successfully giving .odb option in the drop down menu.