Add support for importing tables from LibreOffice Base to Kexi

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.

Project description

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.

Project details

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()
Connection con;
con = DriverManager.getConnection( “jdbc:hsqldb:file:”+ path to directory+file name,”SA”,  “” );

I call this driver connection method from my C++ code. For example,

bool odbMigrate::drv_connect()
JNIEnv *env;
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.



4 thoughts on “Add support for importing tables from LibreOffice Base to Kexi

  1. Pingback: Links 13/6/2014: Docker Hype, Manjaro 0.8.10 | Techrights

  2. Is odb also part of the Open Document Format standard? If so, wouldn’t it be better to let odb be the default format of Kexi? Anyway, it would be good if Kexi would also export to odb and not only import odb.

    • Anon: your idea is good in principle. However ODB is OO/LO’s own format with single java based implementation. If we could we’d share a format. All I was able to do is to contribute to the ODF specs regarding db connection info structures.

      The gsoc project for Kexi has a wiki page where you can find more info.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s