Using Java ODBC on Base databases

I would like to use Java and ODBC to connect to my .odb database. In Access, I can use a connection string that looks like:

jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=mydb.mdb;DriverID=22;READONLY=false;

However, there is apparently nothing equivalent for Base.

I have been converting from MS Office to LibreOffice, and have had little trouble using Writer and Calc to get equivalent results. So far, however, Base has been fairly disappointing. I have a number of Java applications that use Access .mdb files and would like to convert them to .odb, but this seems to be the impossible dream. Am I wrong?

I realize this question is essentially the same as both How to read .odb file in java using JDBC? and can I access a Base database with java. However, those are 4 and 3 years old respectively and, while it may qualify under the definition of insanity, I was hoping for a different answer now.


When I moved my Access stuff to GNU/Linux it turned out to be a quite involved process. To ease this transition I first copied my tables from Access to MariaDB. Then I reconfigured Access to point to the tables in MariaDB so I could keep using Access for awhile longer. Now I could use HeidiSQL running under Wine to help with the type changes needed, e.g. Memo to Text, timestamp issues, and yes/no to tinyint, etc. Then I started work on getting LibreOffice to talk to the tables in MariaDB.

Some of the notes from this process I left here.

Also as I recall, when I tried to do what you are working on, I was never able to get ODBC to work for me. I finally gave up and came at it from a different angle. But that was awhile ago, and some things have been fixed, and I might have missed something back then. In any event, when you finally do make some progress, please leave a bread crumb trail here of what has worked for you. Thanks.


First know I am not into Java code - just dabbled a bit. Have created a Java application which retrieves data from a database used in Base to generate a report. Did this about 18 months ago.

Now what you are talking about actually has nothing to do with Base but with a database connection. The typical connection is done using JDBC, ODBC or SBDC. With these type of connectors you can use Base to converse with many different databases. The easiest database for people to use is the HSQLDB v1.8 embedded (soon Firebird embedded). These embedded databases may be easy to use but access from external sources is next to impossible. So the next step is to split the database out of the Base enclosure and expose the data to outside sources. This is done using database servers (HSQLDB, MySQL, PostgreSQL, etc) or a process (single user) of running HSQLDB split from the .odb (see → [Wizard] Create a new ‘split’ HSQL 2.x database ).

Once you have a database external to the Base .odb file, it is a matter of using the proper connector & string for your connection. I have only used a JDBC connection in Java with this one to an HSQLDB database (applicable portion of code):

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class OldItems {

    private Connection connection;

	public OldItems() {
		try {
			connection = DriverManager.getConnection("jdbc:hsqldb:file:////home/THE_DIRECTORY_NAME/THE_DATABASE_NAME;default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false", "SA", null);
		} catch (SQLException e) {
		} catch (ClassNotFoundException e) {

Have also done this to a MySQL database but it uses a different driver & connection string.

Much of connection information to HSQLDB is found in Chapter 1 of the manual → Running and Using HyperSQL

Did a quick search for ODBC but found nothing for Java. I’m sure there is some example out there. It should not matter which type of connection you use; just the correct driver and connection string.

Sorry, but this is probably the limit of my Java capabilities for help.

Base is not a database (just as Access isn’t) and you need the database to be external to the .odb file for the connection.

I have used MySQL for Java data, but the issue I have with it for my purposes is that you have to actually have it running on the target machine. If I use Access, I can have the .mdb file available as a resource and use SELECT, INSERT, UPDATE, and DELETE queries, and I would like the same capability for Base. I realize that there needs to be a driver and then the correct connection string, it’s just that I can’t find such things and I was hoping I was mistaken.

Of course you cannot access data in a server database unless the server is up & running. If you want to access data without a server and without Base running, use the split database mentioned in my answer.

You also mention SQL statements. Have them in your code or store them in the database.

I currently have a Java class that deals with my Access database, including all the SQL statements I need for my application. When it makes sense to expect the MySQL server to be running on the target machine, I can (and have for some applications) simply change the connection string and continue to use this same class. I was hoping for the same capability for Base, so that I could get completely away from Access.

I appreciate the responses I have received. Unfortunately, it seems that this is still the impossible dream. I guess I will continue to do as I have been: use MySQL when it is possible to have the server running on the target machine and Access when it isn’t. Oh, well…