Page 1 of 1

Save/Load a blob from a ClientDataset not possible ??

Posted: Mon 14 Jan 2008 12:51
by JeanR
Hello, i try to use odac with the TClientDataset to update some database, but i have a big problem :
all is working, except blob fields (clob is ok)...

- I have a clientDataset, Linked with a TOraProvider who is linked to a TOratable.

- My fisrt step is to generate the cliendataset file, here is a sample :
Table TEST with COLUMN1 & COLUMN2 as Varchar2 and DATABLOB as Blob.

Code: Select all

 ClientDataSet1 := TClientDataSet.Create(Self);
  with ClientDataSet1 do begin
    ProviderName := 'OraProvider1';
    StoreDefs := False;
    IndexDefs.Add('IDX1', 'ID', []);
  end;
  ClientDataSet1.Open;

  ClientDataSet1.Insert;
  ClientDataSet1.FieldByName('ID').Value := 1;
  ClientDataSet1.FieldByName('COLUMN1').Value := 'Test INSERT...';
  ClientDataSet1.FieldByName('COLUMN2').Value := '...of a Blob';

  try
    FS := TFileStream.Create('c:\img.jpg', fmOpenRead);
    FS.Position := 0;

    TBlobField(ClientDataSet1.FieldByName('DATABLOB')).BlobType := ftOraBlob;
    TBlobField(ClientDataSet1.FieldByName('DATABLOB')).LoadFromStream(FS);

    ClientDataSet1.Post;
  finally
    FS.Free;
  end;
  
  ClientDataSet1.SaveToFile('c:\cds.bin', dfBinary);
  ClientDataSet1.Free;

at this step, my clientdataset file is well generated then to sychronize with my database :

Code: Select all

  ClientDataSet1 := TClientDataSet.Create(Self);
  with ClientDataSet1 do begin
    ProviderName := 'OraProvider1';
    StoreDefs := False;
    IndexDefs.Add('IDX1', 'ID', []);
    OnReconcileError := ClientDataSet12ReconcileError;
  end;

  ClientDataSet1.FileName := 'c:\cds.bin';
  ClientDataSet1.Open;
  ClientDataSet1.First;
  ClientDataSet1.ApplyUpdates(-1);
  ClientDataSet1.Close;

  OraSession.Commit;

  ClientDataSet1.free;
With this code, ApplyUpdates freeze the application and sometimes send a ORA-12571 error...

Note :
- If i remove the blob insertion all is ok.
- With Clob it is working
- same code under Firebird database is working

Do you have idea ? this is a critical issue for me :oops:

Many Thanks !!

(ps : Odac v6.25.0.6)

Posted: Tue 15 Jan 2008 10:35
by Plash
We could not reproduce the problem. Please send to odac*crlab*com a complete small sample that demonstrates the problem, including script to create database objects.

Also specify exact version of ODAC (version 6.25.0.6 does not exist) and exact version of Delphi.

Posted: Wed 23 Jan 2008 14:02
by JeanR
Hello,

this is for Delphi 7 Enterprise and Odac v6.25.0.12, sorry for the mistakes ^^.
I will create a little test code and send it to you,
Thanks,
JeanR