H2 Database Spring Boot - How to connect and configure an in-memory H2 database in Spring Boot

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024

ความคิดเห็น • 42

  • @maxjustmax521
    @maxjustmax521 2 ปีที่แล้ว +5

    I have no idea why do you have only 17K subs ... are people blind! I'm glad I found your channel.

  • @zelalemgizachew5563
    @zelalemgizachew5563 5 หลายเดือนก่อน +2

    Sacrified some mins to see this video and saved a lot of debugging hours. Thanks for the content.

  • @sharine8512
    @sharine8512 ปีที่แล้ว +3

    I haven't even finished watching it and I can already say: Beautiful video! I've seen others (channels) very good ones, but this one is sensational. It explains exactly what is happening and why. This is giving me unprecedented autonomy, which I would take a good amount of practice and reading time to achieve. Thank you!🤩

  • @Burborted
    @Burborted 11 หลายเดือนก่อน +1

    God... I haven't seen anything better, sir. Thank you for sharing your expertise.

  • @MUSLIMWORLD2
    @MUSLIMWORLD2 ปีที่แล้ว +2

    Amazing video❤ was struggling for two days then found this master piece.

  • @fabricio.entringer
    @fabricio.entringer 2 ปีที่แล้ว +1

    No doubts! The greatest video about this topic. Simple and straight to the point. 🙂 Congratulations and thanks for sharing it.

  • @abhishekomprakash4074
    @abhishekomprakash4074 7 หลายเดือนก่อน

    Thank you for this video. So much valuable information packed in 1 video. Concisely presented. 💯

  • @berkcr3769
    @berkcr3769 ปีที่แล้ว

    oh man, thank you im intern and im studying for this on 4 days. finally i do that thanks to you

  • @debashishbhattacharjee8188
    @debashishbhattacharjee8188 ปีที่แล้ว +1

    Thanks for sharing such crisps videos.

  • @cyper0418
    @cyper0418 2 ปีที่แล้ว

    Wow, this clears my doubts why you configure the data source that way in your previous tutorials. ❤

    • @cyper0418
      @cyper0418 2 ปีที่แล้ว

      Learned lots of hows and WHYs along the journey, esp. the spring security part. 😘

  • @caginbektas
    @caginbektas 2 ปีที่แล้ว +1

    I must say thank you for all your effort Dan. This is a very clear and effective video

    • @DanVega
      @DanVega  2 ปีที่แล้ว

      I'm glad you found it useful.

  • @magicianam1563
    @magicianam1563 2 ปีที่แล้ว

    Good work, i'm new to spring & this is better than paid courses.

    • @DanVega
      @DanVega  2 ปีที่แล้ว +1

      This made my day! Thank you so much 🤩

  • @andreaang9448
    @andreaang9448 ปีที่แล้ว

    Thanks, this was really clear and helpful for an exercise im doing :)

  • @Alexander-vov
    @Alexander-vov ปีที่แล้ว

    Thanks for the video, it's a really helpful tutorial

  • @coddude3284
    @coddude3284 ปีที่แล้ว

    your work is professional !

  • @PrashantRanjan1212
    @PrashantRanjan1212 2 ปีที่แล้ว +1

    Hey Dan,
    Thanks for your really helpful videos. It would be really nice if you make a video on how to configure databases like Oracle, MySQL or MongoDB etc any one will work.
    Thanks

    • @DanVega
      @DanVega  2 ปีที่แล้ว

      Thank you for the suggestion. I am trying something new to keep track of content suggestions like this one and I have added it to a repo.
      github.com/danvega/office-hours/discussions/24

  • @securethebag1613
    @securethebag1613 9 หลายเดือนก่อน +1

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

  • @alexandern9266
    @alexandern9266 ปีที่แล้ว

    Hi Dan,
    As I can see in SB configs EmbeddedDatabase implements shutdown method (which sends SHUTDOWN command to the DB) and SB registres that as destroy method when no Hikari is used.
    But if we use Hikari+H2 Hikari knows nothing about whether it is an Embedded datasource or not.
    If we use memory-based H2 I suppose it is not a problem.
    But what about file-based H2?
    What do you think is it safe to use file-based H2 with Hikari? Will it close the file properly?

  • @prabhjotsingh9597
    @prabhjotsingh9597 2 ปีที่แล้ว

    love the background

  • @hassanmohamed-iz2un
    @hassanmohamed-iz2un 11 หลายเดือนก่อน

    how does spring repository know about the presence of H2 table

  • @ameensalem673
    @ameensalem673 ปีที่แล้ว +1

    Hi, thank you for this tutorial!!
    i tried to follow when i do new Book(null, "str") i have error that id connot be null
    if i pass an id i have this error : Caused by: java.lang.IllegalArgumentException: After saving the identifier must not be null

    • @DanVega
      @DanVega  ปีที่แล้ว

      This sounds like a schema issue. Are you auto generating an id in your schema?

    • @ameensalem673
      @ameensalem673 ปีที่แล้ว

      @@DanVega this my schema :
      CREATE TABLE IF NOT EXISTS client (
      id INTEGER AUTO_INCREMENT,
      info BLOB
      );

    • @ameensalem673
      @ameensalem673 ปีที่แล้ว

      and this is my client record : public record Client(@Id Integer id, String info) { }

    • @ameensalem673
      @ameensalem673 ปีที่แล้ว +1

      @@DanVega Thank you, i figured it out, the @Id was not imported from the right package

    • @ameensalem673
      @ameensalem673 ปีที่แล้ว

      can we use a string as the id of h2 table ?
      i have this error when i try to insert on the table with the id is a string column : Caused by: java.lang.IllegalArgumentException: After saving the identifier must not be null

  • @kacpersyrnik9853
    @kacpersyrnik9853 2 ปีที่แล้ว

    Why this h2 console configuraton is not working with mvcMatchers?
    MvcMatcher as I understand is better version of antMatcher because it matches not only for example /demo but also /demo/ and /demo.html
    In My project
    mvcMatchers("/h2-console/**) is not working but if i have the antMatchers("/h2-console/**) as you, everything is fine, but why?

  • @berkcr3769
    @berkcr3769 ปีที่แล้ว

    i love this video!

  • @alfonsovargas8578
    @alfonsovargas8578 ปีที่แล้ว

    How I can create a repository using sql raw in H2 DB?

  • @jamesrooney931
    @jamesrooney931 ปีที่แล้ว

    Hi Dan - I'm using Spring Boot 3 (Spring Security 6) and I can't access the H2 console. With Spring Security 6 there is no antMatchers or mvcMatchers only requestMatchers which don't allow us the access the console - I have this line auth.requestMatchers("/h2-console/**").permitAll(). Is there a workaround to allow access?

    • @akashshaw1198
      @akashshaw1198 ปีที่แล้ว

      I am facing the same issue, Did you get any solution?

    • @alexandrp4419
      @alexandrp4419 ปีที่แล้ว

      the same

  • @lucianoortizsilva
    @lucianoortizsilva ปีที่แล้ว

    👏👏👏

  • @mohammedabraruddin9779
    @mohammedabraruddin9779 2 ปีที่แล้ว +1

    love your tutorials but cannot follow as you are using white theme because its difficult for me to work at the white screen, i request you to use dark theme if possible

    • @DanVega
      @DanVega  2 ปีที่แล้ว +2

      I get if dark theme is your personal preference (It's mine too) but I am not sure I understand why you can't follow along? Light themes are just better for tutorials and presentations and are easier for people to follow along with.

    • @mohammedabraruddin9779
      @mohammedabraruddin9779 2 ปีที่แล้ว +1

      @@DanVega i got a eye diesease because of which i can't see properly on white screen but anyways thanks for the reply

  • @dovydasbalciunas5002
    @dovydasbalciunas5002 ปีที่แล้ว

    Wtf is the record class?

    • @DanVega
      @DanVega  ปีที่แล้ว

      Record type is new to Java which is available in Java 16+
      docs.oracle.com/en/java/javase/14/language/records.html