Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-479

Crash in maodbc.dll (MariaDB ODBC 3.2 Driver) version 3.02.06.00 when calling a stored procedure with an OUT DOUBLE parameter in Java.

    XMLWordPrintable

Details

    Description

      Crashes calling getDouble when accessing a parameter passed back by an SQL procedure on MariaDB.

      --------------- T H R E A D ---------------

      Current thread (0x000001bcbb08c830): JavaThread "main" [_thread_in_native, id=27004, stack(0x0000004da1700000,0x0000004da1800000)]

      Stack: [0x0000004da1700000,0x0000004da1800000], sp=0x0000004da17fe850, free space=1018k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C [maodbc.dll+0x13f98f]

      Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
      j com.etlsolutions.jni.odbc.JODBCJNIAPI.getDataDouble(JI[D[J)S+0
      j com.etlsolutions.jni.odbc.JODBCJNIAPI.odbcGetDataDouble(JI[D[J)S+7
      j com.etlsolutions.jni.odbc.JODBC.SQLGetDataDouble(JI)Ljava/lang/Double;+48
      j com.etlsolutions.jniodbc.jdbc.JdbcResultSet.getDouble(I)D+49
      j com.etlsolutions.jodbc.integrationtests.mariadb_tests.verifiers.VerifyCallBatchData.validateGetBatch()Z+329
      j com.etlsolutions.jodbc.integrationtests.mariadb_tests.verifiers.VerifyCallBatchData.validate()Z+501
      j com.etlsolutions.jodbc.integrationtests.mariadb_tests.JdbcOdbcController.validate()Z+19
      j com.etlsolutions.jodbc.integrationtests.mariadb_tests.JdbcOdbcRunner.main([Ljava/lang/String;)V+21
      v ~StubRoutines::call_stub

      siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0xffffffffffffffff

      Stored Procedure:
      DROP PROCEDURE IF EXISTS odbctest.batch_get_using_id;

      DELIMITER $$
      $$
      CREATE DEFINER=`GRYM`@`%` PROCEDURE `odbctest`.`batch_get_using_id`(
      i_id INT,
      OUT o_name VARCHAR(255),
      OUT o_bool TINYINT,
      OUT o_int16 SMALLINT,
      OUT o_int32 INT,
      OUT o_int64 BIGINT,
      OUT o_numeric_5_2 DECIMAL(5,2),
      OUT o_float REAL,
      OUT o_double DOUBLE
      )
      BEGIN
      select string_null, bool_null, int16_null, int32_null, int64_null, numeric_5_2_null, float_null, double_null
      into o_name, o_bool, o_int16, o_int32, o_int64, o_numeric_5_2, o_float, o_double
      from odbctest.odbc38_batch_write
      where id = i_id;
      END$$
      DELIMITER ;

      boolean validateGetBatch()
      {
      boolean result = false;
      LogManager.getLogger(VerifyCallBatchData.class).info("Testing validateGetBatch using IN and OUT...");
      Integer idObject = getBatchIdFromName("name 1");
      if(idObject != null)
      {
      try(CallableStatement call = m_Connection.prepareCall("

      {CALL batch_get_using_id(?,?,?,?,?,?,?,?,?)}

      "))
      {
      call.setInt(1, idObject);
      call.registerOutParameter(2, Types.VARCHAR);
      call.registerOutParameter(3, Types.BOOLEAN);
      call.registerOutParameter(4, Types.SMALLINT);
      call.registerOutParameter(5, Types.INTEGER);
      call.registerOutParameter(6, Types.BIGINT);
      call.registerOutParameter(7, Types.NUMERIC);
      call.registerOutParameter(8, Types.FLOAT);
      call.registerOutParameter(9, Types.DOUBLE);
      call.execute();
      ResultSet rs = call.getResultSet();
      while(rs.next())
      {
      String o_name = rs.getString(2);
      if(rs.wasNull()) o_name = null;
      Boolean o_bool = rs.getBoolean(3);
      if(rs.wasNull()) o_bool = null;
      Short o_int16 = rs.getShort(4);
      if(rs.wasNull()) o_int16 = null;
      Integer o_int32 = rs.getInt(5);
      if(rs.wasNull()) o_int32 = null;
      Long o_int64 = rs.getLong(6);
      if(rs.wasNull()) o_int64 = null;
      BigDecimal o_numeric_5_2 = rs.getBigDecimal(7);
      if(rs.wasNull()) o_numeric_5_2 = null;
      Float o_float = rs.getFloat(8);
      if(rs.wasNull()) o_float = null;
      Double o_double = rs.getDouble(9); // <<---- Crashes in MariaDB (maodbc.dll+0x13f98f)
      if(rs.wasNull()) o_double = null;
      if(o_name != null && o_bool != null && o_int16 != null && o_int32 != null && o_int64 != null && o_numeric_5_2 != null && o_float != null && o_double != null)
      {
      if(o_name.equals("name 1") && o_bool == true && o_int16 == 1 && o_int32 == 1001 && o_int64 == 100001 && o_numeric_5_2.compareTo(new BigDecimal("1.10")) == 0 && o_float.equals(1.1) && o_double.equals((double)1.1));

      { result = true; }

      }
      }
      }
      catch(SQLException ex)

      { LogManager.getLogger(VerifyCallBatchData.class).error("validateGetBatch failed E:" + ex.getMessage()); }

      }
      return result;
      }

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            Ian B Ian Beard
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.