From the course: Building Java Microservices with gRPC

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Database code setup

Database code setup

From the course: Building Java Microservices with gRPC

Start my 1-month free trial

Database code setup

- [Instructor] The next step is to set up the database connection code and the database script. As we spoke earlier, we are going to use the in-memory H2 database. For that we need one class that'll get us that connection to the database and also load the database script file to create tables and insert data into them. To save some time, I've already got this database connection code class ready with me, and it will be available to you under your resources folder of chapter three. So I'm going to just copy this class, go back to the IDE and first create a package under the Java folder. Let's call it com.shopping.db and let's base that class under it. In addition to that, we also need the database script file that is also provided under the resources folder. So let's copy that and paste it under the resources folder of your project. Just to be clear, the H2 database connection class code and the initialized.sql script…

Contents