Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-576

getXXX() method of ResultSet with wrong column name fails to return non-zero vendor (error) code and non-null SQL state

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.2.1
    • 2.2.2
    • JDBC 4.2 compatibility
    • None
    • MariaDB 10.1.30, MariaDB JDBC driver 2.2.1, Ubuntu 16.04

    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.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            mvsagar Vidyasagar Mundroy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.