Spring Boot Java H2 Database Setup in IntelliJ

preview_player
Показать описание
In this tutorial, you are going to learn how to connect to an H2 database using IntelliJ's database tools. We will start by creating a new Spring Boot application with the Web, H2, JPA and DevTools dependencies. We will learn how to configure the H2 database and provide a schema and seed data. Finally, we will create an H2 file database and connect to it from IntelliJ's database tools.

When you have completed this tutorial you should understand:
✅ How to create a Spring Boot application with an H2 database dependency
✅ How to create a schema and seed data for an H2 database
✅ How to configure an H2 Database
✅ How to create an H2 file database
✅ How to connect IntelliJ's database tools to an H2 database

🔗Resources & Links mentioned in this video:

👋🏻Connect with me:

Рекомендации по теме
Комментарии
Автор

What are some of your favorite plugins & themes for IntelliJ?

DanVega
Автор

I'm starting with Spring Boot and Databases and looked exactly for this help. Very useful. Thank you!

SenselessSurvivor
Автор

Thanks a lot! I was wondering, why I can't see my tables in IntelliJ, now I have an answer.

vlogwin
Автор

Thanks, Dan! Fixed my problem when you mentioned "relative paths".

stevekane
Автор

I have to do a demo at work today. That'll be immensely helpful. Thank you!

oels
Автор

Thank you for this amazing video Dan!
For some unclear reason when I try to use a db file and not from memory, the table I created in the data/schema is not visible, also, it didn't require the "sa" username, maybe there's some connection to the issue?

SakanaFamilyVideos
Автор

Hey Dan,
This was useful. Thanks.
Database tools and SQL is not available in community edition. I tried another plugin Database Navigator. Unfortunately that also doen't support h2.
Nonetheless, this video was helpful. Sub'd. Waiting for more content.

ijanijigar
Автор

Thank you, i was really struggling with the h2 mem

josemiranda
Автор

Thanks! After creating the file jdbc connection and testing it, it says my username or password are incorrect, any ideas? After removing both username and password I am able to connect, but there aren't any tables. Only difference is instead of inserting as shown in the video, I'm inserting using CSVread

NikkiCoCoPuff
Автор

Really well explained and clear! Thank you Dan!!!

lauraadomaityte
Автор

Thx for the video.
Currently I am looking for the exact same setup including the IntelliJ View 'Persistence' in order to be able to directly work with jpa-ql when developing.
I do not get it working and I feel somewhat blind on any cause. That is a major use case for me as a devloper: a very efficient way of wrinting queries with JPA.

debastian
Автор

is it possible to use hikari with an in memory database like h2 just to test the pooling?

securethebag
Автор

You are damn good buddy, this helped me a lot.

ralphkinggradison
Автор

Thanks a lot! I didn't know how to get access from IntelliJ!

Автор

Super! Exactly what my challenge has been! Thanks!

georgematua
Автор

Hello. If I log in from console with default datasource url (jdbc:h2:mem:testdb) using sa and "" as username and password, it works smoothly, but if I try to change the datasource url, the application itself will run nicely but then as I'm trying to connect to the h2 database, it throws a "invalid password or username" error. I tried to fix it by setting the username and password manually with the spring.datasource.username and spring.datasource.password, but after that the application won't even run, stating the same issue with invalid password or username.

ainkivimagi
Автор

Ajudou bastante, estava com dificuldades em conectar com o banco h2, obrigado.

jonathasborges
Автор

Very nice. Can you explain zonkey test ? Thank you..

magekezen
Автор

Thanks for the video! when I try use the db file, it doesnt show me the table in the h2 console. It worked when i used it from memory. Any ideas?

patrikbolander
Автор

Despite using the community version I am able to run the code and to open the database in the browser. However, the database is not pulling my table. If you have any idea what the reason might be, let me know.

blandcoffeeamv