Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the driver fully jdbc compliant? #849

Closed
mjhamm75 opened this issue Mar 2, 2022 · 5 comments
Closed

Is the driver fully jdbc compliant? #849

mjhamm75 opened this issue Mar 2, 2022 · 5 comments
Labels

Comments

@mjhamm75
Copy link

mjhamm75 commented Mar 2, 2022

I am trying to use NamedParameterJdbcTemplate and the driver is not interpolating the query arguments into the query string. Here is a StackOverflow describing what is going on.

https://stackoverflow.com/questions/71314115/why-are-namedjdbctemplate-not-working-with-clickhouse-jdbc?noredirect=1#comment126068476_71314115

What am I getting wrong?

@zhicwu
Copy link
Contributor

zhicwu commented Mar 2, 2022

Parameter index must between 1 and 0 but we got 1

The error message is confusing and I really need to make it clear. Anyway, it meant no parameter found in the query.

Can you remove properties.setProperty("namedParameter", "true") and try again? The property is used to enable named parameter support(instead of JDBC style ? placeholders) in JDBC API. NamedParameterJdbcTemplate is an extended wrapper to substitute named parameters to ? placeholders so they won't work together.

As to your question, the driver is not fully JDBC compliant although we tried to make it as close as possible. That's why there's fake transaction even though ClickHouse does not support that.

@zhicwu zhicwu added the question label Mar 3, 2022
@zhicwu
Copy link
Contributor

zhicwu commented Mar 5, 2022

Feel free to reopen if the issue remains.

@zhicwu zhicwu closed this as completed Mar 5, 2022
rernas35 pushed a commit to rernas35/clickhouse-jdbc that referenced this issue May 4, 2022
@pkoosha
Copy link

pkoosha commented Jun 5, 2023

Can you please update me if this issue is resolved? We have an application that uses springboot + mysql jdbc. I have been trying to migrate to clickhouse in a labor saving manner. However, I cannot find if the clickhouse-jdbc is compatible with rowMapper (org.springframework.jdbc.core.RowMapper;) and NamedParameterJdbcTemplate can I use clickhouse jdbc?

@zhicwu
Copy link
Contributor

zhicwu commented Jun 5, 2023

Hi @pkoosha, did you run into specific issue using the JDBC driver? NamedParameterJdbcTemplate should work but I haven't tried RowMapper.

@MatthewLieber
Copy link

@zhicwu I am testing something with the NamedParameterJdbcTemplate and it seems like it creates a prepared statement which is not supported through the mysql interface. Can you please confirm if NamedParameterJdbcTemplate is supported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants