[CONJ-603] Error_code: 1032 ER_KEY_NOT_FOUND is not mapped in ExceptionMapper.mapCodeToSqlState, why? Created: 2018-05-14  Updated: 2021-02-08  Resolved: 2021-02-08

Status: Closed
Project: MariaDB Connector/J
Component/s: question
Affects Version/s: 2.2.3
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Anton Krasnoshchok Assignee: Diego Dupin
Resolution: Incomplete Votes: 0
Labels: None


 Description   

In our tests we are getting UncategorizedSQLException instead of DataIntegrityViolationException since it's not mapped on mariadb driver side,
but we have error code mapping in mysql driver 5.1
can you advise what we are doing wrong? Is it something that should be fixed on mariadb driver side?



 Comments   
Comment by Diego Dupin [ 2018-05-28 ]

The server sends error code and SQL state for each error. Error code permits to identify the exact error (because error message can be internationalized), SQL state indicate the error category. Those categories permit to create the appropriate SQLException instance, like DataIntegrityViolationException.

The connector doesn't normally have to map error code but must rely on SQLState.
Error 1032 has an associate "HY000" error code that corresponds to generic kind of error, so the connector will throw a "basic" SQLException, a "23000" error would be an Integrity constraint violation error, then spring would throw DataIntegrityViolationException.

The correction would be on server side changing error the SQL state associate to error 1032 from 'HY000' to '23000'.
Could you explain why you think that error must be an integrity constraint violation (It doesn't seem to me to be this kind of error, but I'm no expert in this area).
Or better, directly create an issue server side (https://jira.mariadb.org/projects/MDEV/)

Comment by Diego Dupin [ 2021-02-08 ]

closing since no answer since 2 years

Generated at Thu Feb 08 03:16:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.