[CONJ-576] getXXX() method of ResultSet with wrong column name fails to return non-zero vendor (error) code and non-null SQL state Created: 2018-02-04  Updated: 2018-03-08  Resolved: 2018-03-08

Status: Closed
Project: MariaDB Connector/J
Component/s: JDBC 4.2 compatibility
Affects Version/s: 2.2.1
Fix Version/s: 2.2.2

Type: Bug Priority: Minor
Reporter: Vidyasagar Mundroy Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

MariaDB 10.1.30, MariaDB JDBC driver 2.2.1, Ubuntu 16.04


Attachments: Java Source File MariaDbGetColNameBug.java    

 Description   

When wrong column name is used to retrieve the column value from a table, an SQLException is thrown but the exception contains vendor code 0 and SQL state null though error message is as expected.

You can reproduce the problem using attached JDBC program.
Here is the sample output:
Connected to jdbc:mariadb: ....<removed actual info purposefully>
Dropping test table tbl_getcolbug...
Dropped the test table.
Creating test table tbl_getcolbug(c1 INTEGER)...
Created the test table.
Inserting value 10 into column c1 of test table tbl_getcolbug...
Inserted the value.
Executing SELECT to get value from coolumn c1 of test table tbl_getcolbug...
Executed the SELECT statement...
Retrieving column value using getInt("c1")...
Retrieved value=10
Pass test if retrieved value is 10
Retrieving value from invalid column using getInt("col_xyz")...
**Error**: Vendor code=0,SQL State=null, error message=No such column :col_xyz
Pass test if vendor code != 0 and SQL State != null.


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