Skip to content

Conversation

@oleg-zinovev
Copy link
Contributor

@oleg-zinovev oleg-zinovev commented Apr 12, 2025

Summary

Contains several improvements and fixes for the v2 of the client and driver

Improvements:

  • PreparedStatementImpl: getMetaData returns result set metadata using describe query
  • StatementImpl: maxRows handling
  • Driver: unload method fixed (DriverManager search driver for unregister by reference equality)
  • HttpAPIClientHelper: added sslmode option (presents in v1), support to skip ssl validation

Fixes:

  • PreparedStatementImpl: ignores question mark (?) in comments, string literals and quoted identifiers
  • StatementImpl: multiline block comments trim
  • HttpAPIClientHelper: null pointer exception with unpooled connection (poolControl is null)

Closes #2290

Checklist

Delete items not relevant to your PR:

@CLAassistant
Copy link

CLAassistant commented Apr 12, 2025

CLA assistant check
All committers have signed the CLA.

@mzitnik mzitnik mentioned this pull request Apr 13, 2025
4 tasks
@mshustov mshustov requested a review from chernser April 14, 2025 07:39
@mshustov mshustov added this to the 0.8.4 milestone Apr 14, 2025
@mshustov mshustov requested a review from Copilot April 14, 2025 09:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

 - PreparedStatementImpl: getMetaData returns result set metadata using describe query - StatementImpl: maxRows handling - Driver: unload method fixed (DriverManager search driver for unregister by reference equality) - HttpAPIClientHelper: added sslmode option (presents in v1), support to skip ssl validation fixes: - PreparedStatementImpl: ignores question mark (?) in comments, string literals and quoted identifiers - StatementImpl: multiline block comments trim - HttpAPIClientHelper: null pointer exception with unpooled connection (poolControl is null)
if (this.currentResultSet != null) {
return currentResultSet.getMetaData();
} else if (statementType != StatementType.SELECT) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it return an empty result set?
I think, null is not expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null is expected according to PreparedStatement javadoc:

* @return the description of a {@code ResultSet} object's columns or * {@code null} if the driver cannot return a * {@code ResultSetMetaData} object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chernser Removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I agree that specification allows to return null, but some frameworks doesn't accept it so we need to implement this another way - at least return an empty result set.

@chernser
Copy link
Contributor

@oleg-zinovev thank you for the contribution!
Would you please exclude:

  • PreparedStatementImpl: getMetaData returns result set metadata using describe query - I'm working on it and have a bigger change to support more cases
  • HttpAPIClientHelper: added sslmode option (presents in v1), support to skip ssl validation - We need to discuss this because why to exclude ssl validation when you do not use it. In other cases we need to support self signed certificates but need another way to do so.

Thanks!

@oleg-zinovev
Copy link
Contributor Author

oleg-zinovev commented Apr 15, 2025

@oleg-zinovev thank you for the contribution!
Would you please exclude:

PreparedStatementImpl: getMetaData returns result set metadata using describe query - I'm working on it and have a bigger change to support more cases
HttpAPIClientHelper: added sslmode option (presents in v1), support to skip ssl validation - We need to discuss this because why to exclude ssl validation when you do not use it. In other cases we need to support self signed certificates but need another way to do so.
Thanks!

Done.
Also remove DriverHolder class.

For example:

sslmode is convenient for DBeaver (and similar programs). It is much easier (in the case of a self-signed certificate) to disable its verification than to explain how to specify the server certificate correctly.
Unfortunately, in our case, the use of endpoints without encryption is prohibited.

So I hope that the ability to disable tls cert validation will be added to client_v2/jdbc_v2 :)

- PreparedStatementImpl:getMetadata - sslmode
@chernser
Copy link
Contributor

@oleg-zinovev thank you for the update!
I've run CI and will approve shortly.

As for SSL strict mode I've created a separate issue #2309
I would like implement it in the way:

  • It doesn't confuses users with configuration. SSL mode can be theoretically applied to SSL auth and may be need to have another configuration
  • User may need more configuration over SSL (we had a request for custom SSL factory)
    So yes, we will work on it.
@chernser chernser merged commit 4856225 into ClickHouse:main Apr 15, 2025
19 of 23 checks passed
@chernser chernser removed this from the 0.8.4 milestone Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants