Hi guys,
I am trying to connect a integration test with a embedded GitHub - zonkyio/embedded-database-spring-test: A library for creating isolated embedded databases for Spring-powered integration tests..
i am trying to test a simple repository created to query a embedded postgresql database but i would like to know the current capabilities that exist to configure persistence.xml to connect to this kind of database.
i am having this problem when i run the test:
Caused by: org.hibernate.HibernateException: could not determine Dialect from JDBC driver metadata (specify a connection URI with scheme ‘postgresql:’, ‘mysql:’,
Any suugestion to configure this stuff?
Thanks
Did you find any solution and able to successfully connect to embedded database? I am having issue and these are my logs
``
2025-08-29 09:14:06 [main] INFO o.h.r.pool.impl.DefaultSqlClientPool - HR000011: SQL Client URL [postgresql://127.0.0.1:5432/app]
2025-08-29 09:14:06 [main] INFO o.h.r.v.impl.DefaultVertxInstance - HR000002: Vert.x not detected, creating a new instance
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:5432
```
To be able to help you guys, we would need way more information.
For example, what is the format of the JDBC URL?
Did you try explicitly setting the dialect?
Etc.
The way I did the work around for now is to get the connection details from the JDBC connection and then use that for reactive session factory. The zonky replaces the actual jdbc datasource at runtime with its embedded DB but that doesn’t happen for reactive session factory. (I am assuming thats because zonky is specifically looking for DataSource type)
I tried the annotations and that doesn’t work
@AutoConfigureEmbeddedDatabase(replace = Replace.ANY) @AutoConfigureEmbeddedDatabase(provider = AutoConfigureEmbeddedDatabase.DatabaseProvider.ZONKY, beanName = "hikariDataSourceRead") @AutoConfigureEmbeddedDatabase(provider = AutoConfigureEmbeddedDatabase.DatabaseProvider.ZONKY, beanName = "hikariDataSourceWrite")
This code works for now!
try (Connection c = hikariDataSourceWrite.getConnection()) {
String jdbcUrl = c.getMetaData().getURL().substring(5);
String user = c.getMetaData().getUserName();
System.out.println("jdbcUrl : " + jdbcUrl);
String reactiveUrl = jdbcUrl != null && jdbcUrl.startsWith("jdbc:") ? jdbcUrl.substring(5)
}
So with the above set up this is how my jdbc url and reactive url looks like
jdbcUrl : postgresql://localhost:65248/dlehjvbrbvwn
reactiveUrl: postgresql://localhost:65248/dlehjvbrbvwn