snowflake-jdbc
snowflake-jdbc copied to clipboard
Should not throw exceptions from certain methods in net.snowflake.client.jdbc.SnowflakeDatabaseMetaData
The net.snowflake.client.jdbc.SnowflakeDatabaseMetaData class throws SnowflakeLoggedFeatureNotSupportedException from certain JDBC methods. Throwing those exceptions causes cascading failures in some frameworks that depend on JDBC drivers (e.g. Hibernate). Exceptions should only be thrown from those methods in the case of database access errors (per the java.sql.DatabaseMetaData API). For most of those methods a reasonable value should be returned and exceptions should only be thrown if/when unsupported features are used as opposed to throwing them in methods which simply describe the driver.
The two methods that cause the Hibernate failure are:
net.snowflake.client.jdbc.SnowflakeDatabaseMetaData.getSQLStateType() net.snowflake.client.jdbc.SnowflakeDatabaseMetaData.locatorsUpdateCopy()
Retuning the constant java.sql.DatabaseMetaData.sqlStateSQL
from getSQLStateType() appears to work fine, and returning false
from locatorsUpdateCopy() works as well.
The same principle should be followed for any other java.sql.DatabaseMetaData methods which describe features, to prevent similar issues in other frameworks.