Re: Java based connectivity drivers
On Fri, Jan 13, 2017 at 01:44:42PM +0100, Bunth Tamás wrote: > I'd like to have a better understanding of how the hsqldb and jdbc > drivers work. > Is there any wiki page for them like "FirebirdSQL" for firebird that > I couldn't find? Nah, I don't think so, not on the TDF/LibreOffice wiki. There are some on the OpenOffice wiki, but not what (I think) you are looking for: https://wiki.openoffice.org/wiki/Base/connectivity/HSQLdb#HSQLDB https://wiki.openoffice.org/wiki/HSQLDB_Integration https://wiki.openoffice.org/wiki/HSQLDB:Tips_and_Tricks https://wiki.openoffice.org/wiki/HSQLDB_Localization > The code in connectivity/source/drivers/jdbc contains a bunch of java > function calls afais. So where are the java codes, and how does the > driver call them? The Java code is in the JDBC driver, that is loaded from the system. In the case of embedded HSQLDB, the JDBC driver is bundled with LibreOffice and is handled in the build system by external/hsqldb. It is installed as instdir/program/classes/hsqldb.jar You'll find the source in workdir/UnpackedTarball/hsqldb/ There is also instdir/program/classes/sdbc_hsqldb.jar; I think this contains the hack to redirect HSQLDB writes directly into the in-memory ZIP structure of the ODB instead of to a file. The actual source code to that is in connectivity/source/drivers/hsqldb/Storage* and connectivity/com/sun/star/sdbcx/comp/hsqldb The embedded HSQLDB is mostly just the JDBC driver, with some extras specific to HSQLDB in connectivity/source/drivers/hsqldb (In the case of HSQLDB, "JDBC driver" is a bit of a misnomer, since JDBC is the native API of HSQLDB.) -- Lionel ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Java based connectivity drivers
On 13/01/17 13:44, Bunth Tamás wrote: > Hi, > > I'd like to have a better understanding of how the hsqldb and jdbc drivers > work. > > Is there any wiki page for them like "FirebirdSQL" for firebird that I > couldn't find? maybe there's some old page somewhere here http://www.openoffice.org/dba/ https://wiki.openoffice.org/wiki/Category:Database > The code in connectivity/source/drivers/jdbc contains a bunch of java > function calls afais. So where are the java codes, and how does the > driver call them? it looks like the jdbc driver uses JNI to call Java methods directly from C++. like this, the strings are method name and signature: jobject out = callObjectMethod(t.pEnv,"getMetaData","()Ljava/sql/DatabaseMetaData;", mID) i think there's some generic JDBC implementation in the JRE plus a driver-specific part in the JDBC driver. so for the hsqldb case, i would expect this to call into here: workdir/UnpackedTarball/hsqldb/src/org/hsqldb/jdbc/jdbcConnection.java: public synchronized DatabaseMetaData getMetaData() throws SQLException { another point is that we have (at least on Linux) segregated the JDBC driver into a separate thread for performance reasons, as it turned out that JNI calls on the main thread happen to be really slow. see jdbc.component: environment="@CPPU_ENV@:affine" prefix="jdbc" this means that every UNO call first goes via the affine UNO-UNO bridge onto a separate thread into the C++ JDBC UNO component, then that calls via JNI into the Java library, then the return value of that is converted with some C++ UNO wrapper, then it goes back over the bridge to the calling thread. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Java based connectivity drivers
Hi, I'd like to have a better understanding of how the hsqldb and jdbc drivers work. Is there any wiki page for them like "FirebirdSQL" for firebird that I couldn't find? The code in connectivity/source/drivers/jdbc contains a bunch of java function calls afais. So where are the java codes, and how does the driver call them? Thanks in advance, Tamás Bunth ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice