Icon View Incident Report

Serious Serious
Reported By: Andrey Lesitsyn
Reported On: 8/20/2007
For: Version 1.05 Build 2
# 2448 Inserting BLOB Column Value via the Delphi ADO Components and ODBC Driver Causes Error

I have a serious problem with CLOB fields with using EDB ODBC driver through ADO components (Microsoft OLE DB provider for EDB ODBC driver).

// Environment:
//   Windows XP SP2
//   MDAC 2.8 SP1
//   Delphi 7 update 1
//   EDB ODBC 1.5.0.2 (edbodbc.dll)
//
// The problem is:
//   if use BDE -- Ok
//   if use ADO (Microsoft OLE DB provider for EDB ODBC driver) -- crash
//
// Change in this unit below "Data Source=RBEDB" in ButtonOpenDataBaseClick
// to any another ODBC DSN, then press buttons:
//   -- Open database          (see ButtonOpenDataBase OnClick handler) -- OK
//   -- Create Table with CLOB (see ButtonCreateTable OnClick handler)  -- OK
//   -- Insert null CLOB       (see ButtonInsert1 OnClick handler)      -- OK
//   -- Insert not null CLOB   (see ButtonInsert2 OnClick handler)      -- FAILS on "select..."

procedure TForm1.ButtonOpenDataBaseClick(Sender: TObject);
begin
  ADOConnection1.Close;
  ADOConnection1.ConnectionString := // RBEDB -- my Data Source
  'Provider=MSDASQL.1;Persist Security Info=False;Data Source=RBEDB';
  ADOConnection1.Open;
  Beep;
end;

procedure TForm1.ButtonCreateTableClick(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('CREATE TABLE TABLE_WITH_CLOB (F1 INT, F2 CLOB)');
  ADOQuery1.ExecSQL;

  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('SELECT * FROM TABLE_WITH_CLOB');
  ADOQuery1.Open;
  Beep;
end;

// this code processing OK (empty value of CLOB field)
procedure TForm1.ButtonInsert1Click(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('INSERT INTO TABLE_WITH_CLOB (F1, F2) VALUES(0, null)');
  ADOQuery1.ExecSQL;

  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('SELECT * FROM TABLE_WITH_CLOB');
  ADOQuery1.Open;
  Beep;
end;

// this code fails (non empty value of CLOB field)
procedure TForm1.ButtonInsert2Click(Sender: TObject);
begin
  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('INSERT INTO TABLE_WITH_CLOB (F1, F2) VALUES(1, ''1'')');
  ADOQuery1.ExecSQL;

  ADOQuery1.Close;
  ADOQuery1.SQL.Clear;
  ADOQuery1.SQL.Add('SELECT * FROM TABLE_WITH_CLOB');
  ADOQuery1.Open;
  Beep;
end;



Resolution Resolution
Fixed Problem on 10/28/2007 in version 1.06 build 1


Products Affected Products Affected
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial

Image