Javajson

JDBC JSON Analytics Sample

Plain JDBC sample that analyzes nested JSON documents with advanced SQL/JSON operators.

JSONTestcontainers#Java#JSON#Testcontainers
What this sample helps you learn

This sample explores advanced Oracle SQL/JSON operators with plain JDBC. It stores nested order documents and runs analytical queries using `JSON_TABLE`, `JSON_EXISTS`, and `JSON_ARRAYAGG` to produce insights without shredding JSON data into relational tables.

What this sample demonstrates

JSON

Document-shaped data and SQL/JSON querying inside Oracle AI Database.

Use when records need flexible structure without leaving SQL, indexes, constraints, and transactions.

Testcontainers

Disposable Oracle AI Database Free containers for repeatable local and integration tests.

Use when tests need real database behavior without sharing a long-lived development instance.

Highlights

  • Use JSON_TABLE to project order line items into a relational rowset directly from JSON documents.
  • Aggregate product demand by combining JSON_TABLE, GROUP BY, and ordering to find the top-selling SKUs.
  • Filter orders using JSON_EXISTS predicates and compact the result into JSON arrays via JSON_ARRAYAGG.
  • Package the workflow as a console program and validate it with a Testcontainers-powered integration test.