Page 1 of 1

Error with CLOB larger than 64k

Posted: Mon 03 Oct 2005 19:55
by nschmied
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

Posted: Tue 04 Oct 2005 06:48
by nschmied
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.

Posted: Tue 04 Oct 2005 07:28
by Alex
Please specify your ODAC and Oracle client versions.

Posted: Tue 04 Oct 2005 07:36
by nschmied
The last ODAC 5.55.1.3022
Oracle Client : 10g (10.2.0.1.0)

Posted: Tue 04 Oct 2005 08:47
by nschmied
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;

Posted: Wed 05 Oct 2005 13:07
by Alex
We have reproduced your problem and fixed it. This fix will be included in the next ODAC build.

Posted: Wed 05 Oct 2005 13:11
by nschmied
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 ?

Posted: Wed 05 Oct 2005 14:12
by Alex
We have tested our solution and don't discover any data corruption

Posted: Wed 05 Oct 2005 16:36
by nschmied
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

Posted: Thu 06 Oct 2005 07:05
by Alex
According to the circumstances we are going to release new ODAC build on Friday or on Monday.