Error with CLOB larger than 64k

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Error with CLOB larger than 64k

Post by nschmied » Mon 03 Oct 2005 19:55

Hello,
now I have problems for reading clob larger than 64K.

I have followed your example in your help, but nothing changes.

I am in Unicode on a Oracle10gR1

For reproduice the problem, create a table test_clob with two fields, my_clob_id and my_clob, and put a large XML file in my_clob

After create a TSmartQuery use Select * from Test_clob

Code: Select all

smartQuery1.GetLob('my_clob').SaveToFile('xxx');
The function AsString return the same error.

I suppose the error occur when ODAC read the clobsize to the seconde way of reading block.

I'ts my last error, other was resolved.
Thanks,
Nsc
Last edited by nschmied on Tue 04 Oct 2005 06:55, edited 1 time in total.

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Tue 04 Oct 2005 06:48

I have make another test to Oracle 9i and it's work with this version.

And I have test Oracle10g R2 and it's the same error.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 04 Oct 2005 07:28

Please specify your ODAC and Oracle client versions.

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Tue 04 Oct 2005 07:36

The last ODAC 5.55.1.3022
Oracle Client : 10g (10.2.0.1.0)

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Tue 04 Oct 2005 08:47

I have make test with ODP.NET and it's work.

Code: Select all

procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs);
var
  sql : string;
  cmd : OracleCommand;
  dr : OracleDataReader;
  myOracleClob : OracleClob;
  charArray : array of char;
  Fichier : StreamWriter;
  nomFichier : String;
  numCharsRead : integer;
begin
  //Connection
  oradb := 'Data Source=NETLOC10;User Id=PCS;Password=xxx;';
  conn := OracleConnection.Create;
  try
    conn.ConnectionString := oradb;
    conn.Open;

    sql := 'select * from test_clob where my_clob_id=3';
    cmd :=OracleCommand.Create(sql, conn);
    cmd.CommandType := CommandType.Text;
    dr := cmd.ExecuteReader;
    dr.read;
    myOracleClob := dr.GetOracleClob(0);
    nomFichier := DateTime.Now.ToLongTimeString+'.xml';
    nomFichier := 'c:\pcs\xml\txt_'+nomFichier.Replace(':','_');
    if not &File.Exists(nomFichier) then
    begin
      // Le fichier n'existe pas.
      Fichier := StreamWriter.create(nomFichier,true,System.Text.Encoding.UTF8); //FileCreate(nomFichier);// crée et ouvre le fichier
      if Assigned(Fichier) then
      begin
        SetLength(charArray,65414);
        numCharsRead := myOracleClob.Read(charArray, 0, 65414);
        while ((numCharsRead) > 0) do
        begin
          Fichier.Write(charArray);
          numCharsRead := myOracleClob.Read(charArray, 0, 65414);
        end;
  //      if FileWrite(Fichier, Lignes,Lignes.Length)=-1 then
        Fichier.Close;
      end;
    end;
  finally
    dr.Close;
    conn.Close;
  end;
end;

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 05 Oct 2005 13:07

We have reproduced your problem and fixed it. This fix will be included in the next ODAC build.

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Wed 05 Oct 2005 13:11

Greats, but another question. Have you check if the content of clob is valide ?

Because, my last test with ODP.NET work but the content of CLOB was not correcte ?

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 05 Oct 2005 14:12

We have tested our solution and don't discover any data corruption

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Wed 05 Oct 2005 16:36

Ho marvellous,

And when it's the next release ? tomorrow :D

It's possible to have a beta release by email ?
because I deploy my application Friday !!!!

Short time

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Thu 06 Oct 2005 07:05

According to the circumstances we are going to release new ODAC build on Friday or on Monday.

Post Reply