Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect my Quarkus project to SQLITE database?

Sorry im newbie here, my quarkus project is get data from mysql database and generate the data to sqlite database. i have 2 question:

  1. is quarkus possible to connect 2 database in same time?(in my case connect from mysql and connect to sqlite) and how the correct way to do it?
  2. How the correct way to connect my quarkus project with sqlite? Beacause i have seen the documentation from quarkus.io, and i didnt see the extension for connect my quarkus project into sqlite database. list quarkus jbdc to connect database

thanks

like image 657
Aji Avatar asked Dec 06 '25 08:12

Aji


1 Answers

The answer depends a bit on if you are using Hibernate ORM or plain JDBC datasources.

Connecting to a sqlite datasource

If you're not using native, you can just use the plain old sqlite JDBC driver and do something like: https://quarkus.io/guides/datasource#other-databases .

This is an example for Oracle but do the exact same thing for sqlite.

Injecting named datasources

To handle multiple datasources, just follow this part of the guide: https://quarkus.io/guides/datasource#multiple-datasources .

You can perfectly well handle both sqlite and MySQL.

Hibernate ORM

So for Hibernate ORM, you will need the multiple persistence units support that is coming with Quarkus 1.8 that should be released on September 15th.

We already released 1.8.0.CR1 and if you're curious and want to give it a test ride, the documentation is available here (it's not yet on the website, it will be pushed with the Final release): https://github.com/quarkusio/quarkus/blob/master/docs/src/main/asciidoc/hibernate-orm.adoc#multiple-persistence-units .

like image 114
Guillaume Smet Avatar answered Dec 07 '25 21:12

Guillaume Smet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!