In B4X (e.g., B4J) with the DuckDB JDBC driver, you use the standard B4X SQL library for database interactions.
Here is an example demonstrating connection, table creation, data insertion (using a batch operation), and selection:
Prerequisites
In your B4J project, you need to add the DuckDB JDBC driver to your project and add the following attribute to your Globals or StarterService module:
b4x
#AdditionalJar: duckdb_jdbc-x.x.x.jar ' Replace x.x.x with the actual version number
You also need a SQL object declared in your globals:
b4x
Private SQL As SQL
Example Code
An example demonstrating connecting to a DuckDB database, creating a table, inserting data using a batch operation, and selecting data can be found on
b4x.com.