Chapter 7. Working with Databases in Groovy

In this chapter, we will cover:

  • Creating a database table
  • Connecting to an SQL database
  • Querying an SQL database
  • Modifying data in an SQL database
  • Calling a stored procedure
  • Reading BLOB/CLOB from a database
  • Building a simple ORM framework
  • Using Groovy to access Redis
  • Using Groovy to access MongoDB
  • Using Groovy to access Apache Cassandra

Introduction

The group of recipes presented in this chapter deals with data persistence, either through a relational SQL database or a NoSQL database.

The first recipe describes how to access and modify data stored in a relational database, such as Oracle or MySQL. Groovy makes accessing data using the SQL language a very elegant affair, compared to the clunky Java's JDBC APIs.

The last three recipes show how to use Groovy with the emerging NoSQL databases, such as Redis, MongoDB, and Cassandra. Each of those recipes contains the steps to connect, persist, and retrieve data with one of the three key/value stores.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.177.125