pelenthium / clickhouse-dialect-spring-boot-starter

Clickhouse dialect to Spring JDBC
Apache License 2.0
25 stars 1 forks source link

Dialect Error #11

Closed HanYoonSoo closed 9 months ago

HanYoonSoo commented 10 months ago

Hello! How do I create an application.yml for Clickhouse? The Dialect related error continues to appear.

pelenthium commented 10 months ago

Hi, you need to specify right connection url, like this jdbc:clickhouse://localhost:8123/datasets

you can check the example project https://github.com/pelenthium/spring-clickhouse-example/blob/main/jdbc/src/main/resources/application.properties

HanYoonSoo commented 10 months ago

MyCode: spring: datasource: driver-class-name: com.clickhouse.jdbc.ClickHouseDriver url: jdbc:clickhouse://localhost:8123/test_db username: root password: rootroot

Error: Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')

This is my code.. I ran Clickhouse in Docker and Connection url seems to be correct.

pelenthium commented 10 months ago

This project make a Jdbc dialect for Spring Data JDBC, and you told about Hibernate Dialect, it's not the same. but you can specify spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect to work with Hibernate, because Clickhouse is Mysql compatible

HanYoonSoo commented 10 months ago

Oh, it worked. Thank you!! I change driver

Before: ru.yandex.clickhouse.ClickHouseDriver

After: com.clickhouse.jdbc.ClickHouseDriver

and it was successful. What is the exact reason?

pelenthium commented 9 months ago

I don't know what the reason is, maybe it's because ru.yandex.clickhouse.ClickHouseDriver is too old and now this class is depricated

Note: ru.yandex.clickhouse.ClickHouseDriver and everything under ru.yandex.clickhouse will be removed starting from 0.4.0.