DuckDB can be embedded in a Java Maven project with a single JDBC dependency, enabling SQL queries directly over CSV, JSON, and Parquet files — local or remote — without setting up a database server. The post walks through setup, a working code example querying a CSV file from GitHub via SQL, and practical use cases: replacing hand-rolled CSV parsers, in-memory aggregation instead of nested HashMap loops, generating large test datasets, and reading Parquet without the Hadoop ecosystem. Honest caveats include large jar size (40–90 MB), native code running in-process (JVM crash risk), no cross-process sharing, and a Windows runtime dependency.
Table of contents
SetupQuerying a file on the internet with SQLWhere this is actually usefulThe honest caveatsSumming up72 Impressions