Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using MySQL Document Store with Java

Using MySQL Document Store with Java

MySQL Document Store offers developers the best features of NoSQL and relational, SQL-based databases. In this session, we will discuss how we can use Java to access a MySQL Document Store, create/remove collections, create/update/remove documents, retrieve, filter, & sort document lists, and leverage raw SQL to retrieve aggregate data for reporting purposes.

Scott Stroz

March 13, 2024

Transcript

49 slides
  1. • MySQL Developer Advocate • Full-stack developer for longer than

    the term "full-stack developer" has existed. • The only constant in my stack has been MySQL • Die-hard NY Giants fan • Avid golfer • I have the best office mate Obligatory "I Love Me" Slide 3/13/24 Copyright © 2021, Oracle and/or its affiliates 2
  2. • "NoSQL" vs relational databases • What is MySQL Document

    Store? • The anatomy MySQL Document Store data • How to access MySQL Document Store • Connecting to MySQL Document Store with Java • Using the CRUD API • Using raw SQL to query our documents What will we cover? 3/13/24 Copyright © 2021, Oracle and/or its affiliates 3 Photo by Alexander Grey on Unsplash
  3. • Slower development time • As more related data is

    added, CRUD operations can get more complex Copyright © 2021, Oracle and/or its affiliates 4 NoSQL "NoSQL" vs Relational Data • Data can be structured and organized • Easier to run queries for reporting Relational Data • Faster development time • Easier to modify the 'schema' • Simple CRUD API • Data is unstructured • Difficult to run queries for reporting 3/13/24
  4. • JSON document storage solution built on top of MySQL

    • Documents are stored in a MySQL Table • InnoDB storage engine • ACID compliant • Uses JSON datatype • Easy to use CRUD API What is MySQL Document Store? 3/13/24 Copyright © 2021, Oracle and/or its affiliates 5
  5. • Schema • Schema - database • Collection • Table

    • Document • Row in table • Table Columns* • _id • varbinary(32) • doc • JSON • _json_schema • JSON * Others if you add indexes. Anatomy of MySQL Document Store Copyright © 2021, Oracle and/or its affiliates 6 Photo by Kira auf der Heide on Unsplash 2/15/2023
  6. • X-Plugin • Installed by default since 8.0.1 • Uses

    the X Protocol through MySQL Connectors (SDKs) • Connectors available for How do we access MySQL Document Store? 3/13/24 Copyright © 2021, Oracle and/or its affiliates 7 • Node.js • C++ • Python • PHP • .Net • MySQL Shell • Java Photo by Museums Victoria on Unsplash
  7. • Demo of using a REST API • Built using

    Micronaut with Java • Uses 2 different database connections (more on that later) • Most of the demo uses the X-Dev API • The schema looks like à About the Demo Application 3/13/24 Copyright © 2021, Oracle and/or its affiliates 8
  8. 3/13/24 Copyright © 2021, Oracle and/or its affiliates 9 NOT

    PRODUCTION READY!! This Photo by Unknown Author is licensed under CC BY-NC
  9. Using Raw SQL – with X-Dev API & Micronaut Data

    3/13/24 Copyright © 2021, Oracle and/or its affiliates 31
  10. Using Raw SQL – with X-Dev API & Micronaut Data

    3/13/24 Copyright © 2021, Oracle and/or its affiliates 32
  11. Using Raw SQL – with X-Dev API & Micronaut Data

    3/13/24 Copyright © 2021, Oracle and/or its affiliates 33
  12. Using Raw SQL – with X-Dev API & Micronaut Data

    3/13/24 Copyright © 2021, Oracle and/or its affiliates 34
  13. Using Raw SQL – with X-Dev API & Micronaut Data

    3/13/24 Copyright © 2021, Oracle and/or its affiliates 35
  14. Using Raw SQL – with X-Dev API & Micronaut Data

    3/13/24 Copyright © 2021, Oracle and/or its affiliates 36
  15. • "NoSQL" vs Relational Databases • Overview of MySQL Document

    Store • Anatomy of MySQL Document Store • X-Plugin and X-Protocol for connectivity • Adding Java connector and configuring the connection • Using the CRUD API • Leveraging the power of raw SQL for ad-hoc queries Recap 3/13/24 Copyright © 2021, Oracle and/or its affiliates 43
  16. Contact Me 3/13/24 Copyright © 2021, Oracle and/or its affiliates

    47 Email [email protected] LinkedIn https://www.linkedin.com/in/scott-stroz/ Twitter https://twitter.com/boyzoid
  17. 3/13/24 Copyright © 2021, Oracle and/or its affiliates 48 Would

    you like credit for a FREE MySQL Certification Exam or Training? See me after the session!

More Decks by Scott Stroz

Other Decks in Technology