Hello,
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 {
Class.forName("org.hsqldb.jdbcDriver");
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);
build();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
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.