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

Error when updating blob field

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 3.1.1
    • None
    • None
    • ODBC 3.1.1 with MariaDB 10.3.15 under Windows Server 2008

    Description

      I use a function to update a BLOB field working for more then teen years with MyODBC 3.51.12, now i have try with MariaODBC 3.1.1, but a error has show.

      I have using Windows Server 2008 32 bits (IIS 7.0) with Classic ASP and MariaODBC Connector 3.1.1.

      The MariaDB version is 10.3.15 64 bits running in other server, into Windows 10 64 bits.

      In have installed the MyODBC versions 3.51.12, 5.1.13, 5.2.7 and 5.3.6.
      With version 3.51.12 working fine, with 5.1.13, 5.2.7 or 5.3.6 all returning this error:

      =====================================
      Microsoft OLE DB Provider for ODBC Drivers erro '80004005'
      [MySQL][ODBC 5.3(w) Driver][mysqld-5.6.34-log]Build WHERE -> insert_fields() failed.
      =====================================

      With MariaODBC 3.1.1, this is a error:

      ==========================
      Microsoft OLE DB Provider for ODBC Drivers erro '80004005'
      [ma-3.1.1][10.3.15-MariaDB]Can't build index for update/delete
      ==========================

      How to repeat:

      • Install a MariaODBC 3.1.1 in Windows.
      • Create a test table:

      CREATE TABLE `testtable` (
      `id` INT(11) NOT NULL AUTO_INCREMENT,
      `file` MEDIUMBLOB NULL,
      PRIMARY KEY (`id`)
      )
      COLLATE='latin1_swedish_ci'
      ENGINE=MyISAM;

      • Create a ASP file (test.asp) with:

      ========================
      BEGIN TEST.ASP

      <%
      wstring="DRIVER=

      {MariaDB ODBC 3.1 Driver}

      ;SERVER=127.0.0.1;PORT=3306;DATABASE=test;UID=testuser;PWD=testpass;OPTION=16427"
      Set connec=server.createobject("adodb.connection")
      connec.Open wstring

      sql="delete from testtable where id=1"
      set xx=connec.execute(sql)
      set xx=nothing

      sql="insert into testtable (id,file) values (1,'')"
      set xx=connec.execute(sql)
      set xx=nothing

      Const adOpenStatic = 3
      Const adLockOptimistic = 3

      Set Rs = Server.CreateObject("ADODB.Recordset")
      Set Rs.ActiveConnection = connec

      Rs.CursorType = adOpenStatic
      Rs.LockType = adLockOptimistic

      xsource="select file from testtable where id=1"
      Rs.Source = xsource
      Rs.Open

      Const adTypeBinary = 1

      Dim BinaryStream
      Set BinaryStream = CreateObject("ADODB.Stream")

      BinaryStream.Type = adTypeBinary

      BinaryStream.Open

      BinaryStream.LoadFromFile "image.jpg"

      ReadBinaryFile = BinaryStream.Read

      RS("file").AppendChunk ReadBinaryFile
      RS.Update

      set ReadBinaryFile=nothing

      BinaryStream.close
      set BinaryStream=nothing

      connec.close
      set connec=nothing
      %>

      END TEST.ASP
      ==============================

      Save any small image file in same folder of test.asp with name image.jpg and execute the test.asp in browser for run the application.

      The error occurs in line:
      RS.Update

      Attachments

        1. SQL-create-table.txt
          0.2 kB
        2. test.asp
          1 kB
        3. image.jpg
          image.jpg
          37 kB

        Activity

          People

            Lawrin Lawrin Novitsky
            lascjr Luis A S C Junior
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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