JDBC Workbook

Learn the JDBC fundamentals which every Java application that uses a database builds upon.

JDBC workbook is a book and video course that teaches you the fundamentals of connecting your Java application to any database.

Learn how to open up database connections, use connections pools and embedded databases, log and fire basic and advanced SQL queries. Then learn about advanced topics, such as database transactions, locking & isolation levels.

All, in the form of a workbook. This means you will have to work your way through the book sequentially and finish a lot of practical and interesting exercises along the way.

View the Packages Get a Sample

What's Inside

  139-page e-book

No personal anecdotes or fluff. Just real-world, practical JDBC content, explained in detail, right from page one.

  2 Hours of Video

Every chapter from the book (minus the exercises) covered in depth. Also, two additional, video-only tutorials.

  Exercises

Every chapter comes with interesting exercises that make you immediately practice your newly learned skills.

  Solutions

At the end of the book, you'll find a chapter devoted to solutions, source code and explanations to the exercises.

"If you are looking for an easy step by step overview of JDBC and how to use it in Java, your search just ended. Marco breaks everything down into easy to follow lessons, reinforcing everything through exercises at the end of every chapter. You will finish the book with a new appreciation and understanding of the things that happen behind the scenes in Spring, JPA and Hibernate. There aren’t many page turners in tech literature, but this is one of them. I highly recommend it! "

Jacob Andersen

Watch a Screencast

JDBC Workbook includes over 2 hours of screencasts covering all chapters of the book, broken down into 26 videos.

Table of Contents

The Preface quickly covers how you should read and work through this book and video course (hint: sequentially) and set up the book's project.

  Preface

  • Who Is This Book For?
  • What’s in This Book?
  • How to Read This Book?
  • Project Setup
  • Acknowledgments

The first chapter of this book covers the basics of the basics: JDBC drivers, opening connections to databases with Java, creating data sources & using connections pools.

  Connecting To Databases

  • In-Memory H2 Database
  • Database Connections
  • Username & Password Combinations
  • File-Based H2 Databases
  • DataSources
  • Connection Pools
  • Wrapping Up
  • Exercises
  • How to Connect to a MySQL Database Video Only
  • How to Open H2 in a GUI Video Only

The second chapter focuses on firing any SQL query you want with JDBC (select, insert, update, delete), as well as more advanced topics like traversing huge resultsets or batching statements.

  SQL Queries

  • Schema Creation
  • SQL Single Inserts & Autogenerated Keys
  • SQL Batch Inserts
  • SQL Selects & ResultSets
  • SQL Updates & Deletes
  • Queries Revisited
  • Logging SQL queries
  • Wrapping Up
  • Exercises

The third chapter teaches you about database transactions with JDBC: auto-commit modes, commit, rollback, savepoints.

  Transactions

  • Schema
  • Autocommit Mode
  • Start & Commit Transactions
  • Rollback Transactions
  • Savepoints
  • Spring’s @Transactional
  • Wrapping Up
  • Exercises

The fourth chapter (my personal favorite) covers the driest JDBC topics in a fun way: isolation levels, locks, as well as optimistic and pessimistic locking.

  Isolation & Locking

  • Transaction Isolation Levels
  • Read Uncommitted
  • Read Committed
  • Repeatable Read
  • Serializable
  • Isolation Levels: Summary
  • Database Locking
  • Tables-Locking vs Row-Locking
  • Optimistic Locking
  • Pessimistic Locking
  • Spring & Hibernate
  • Wrapping Up
  • Exercises

The last chapter contains the solutions for all exercises of the previous chapters.

  Solutions Book Only

  • Connecting To Databases
  • SQL Queries
  • Transactions
  • Isolation & Locking

What People Are Saying

Get a Free Sample

Get a peek at the content. Enter your email address and I'll send you a sample PDF containing a chapter of JDBC connection and transaction fundamentals.

Get JDBC Workbook

Choose the package that works for you.

The Premium Training Package

  • 2 hours of screencasts, covering all of the book chapters + 2 additional video tutorials.
  • The 139-page book in PDF format
  • + ePub, mobi, & HTML formats
  • Comprehensive set of exercises
Buy Now | $50 $40

The Bare Essentials

  • The 139-page book in PDF format
  • + ePub, mobi, & HTML formats
  • Comprehensive set of exercises
Buy Now | $20 $15

About the author

Hey! I'm and I share everything I know about making awesome Java software through my guides, screencasts, talks and .

Follow me on Twitter to get in touch.

Frequently Asked Questions

Is this book useful if I'm using Spring or Hibernate?

100% absolutely yes! It does not matter if you are using Spring, or Hibernate or any other Java database framework.

They all build on top of the JDBC basics that you are going to learn in this book. You'll also find cross-references in this book to these frameworks, where it makes sense.

What if I don't like the book? What about refunds?

Yes. Send me an email for up to 14-days after purchase and I'll refund you the full price without any hard feelings.

Is the book available in ePub or mobi formats?

Yes. When you buy the book you'll be able to download a zip file containing the book in various formats: PDF, ePub, Mobi and even HTML!

Is there also a print version of the book available?

Unfortunately not.

I have another question!

Sure! Shoot me an email at marco@marcobehler.com and let's chat!