Blob truncated with oracle odbc 11.02

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kronski
Posts: 2
Joined: Fri 06 Dec 2013 14:07

Blob truncated with oracle odbc 11.02

Post by kronski » Fri 06 Dec 2013 14:35

Hi,

I'm trying to convert a old application that uses BDE to use unidac instead using delphi XE5.

When I write blobs to the database then the blob gets truncated to 4000 characters.
I write to a clob field with a regular update query using TUniQuery by passing a parameter.
It's the TODBCUniProvider that truncates. TOracleUniProvider works. The old BDE application works and i wrote a C# application that uses System.Data.Odbc.OdbcConnection which also works so the odbc driver works for sure.

Any help would be appreciated.

Code

UniQuery1.sql.text := 'UPDATE tablename set xmldata=:xmldata WHERE id=4';
//UniQuery1.ParamByName('xmldata').LoadFromFile('c:\temp\myxmltest.xml',ftOraClob); // fails
//UniQuery1.ParamByName('xmldata').AsMemo := a_long_str; // fails
UniQuery1.ParamByName('xmldata').LoadFromFile('c:\temp\myxmltest.xml',ftBlob);

End code

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Blob truncated with oracle odbc 11.02

Post by AlexP » Mon 09 Dec 2013 09:25

Hello,

This behaviour is due to the fact, that for some databases there is a parameter size restriction. Therefore we have added the DefaultStrParamSize option. Its size is 4000 by default. To solve the problem, you should set the correct parameter size, for example:

Code: Select all

var
  s: string;
begin
  UniQuery1.sql.text := 'UPDATE tablename set xmldata=:xmldata WHERE id=4';
  s := StringOfChar('c',5000);
  UniQuery1.ParamByName('xmldata').Size := Length(s);
  UniQuery1.ParamByName('xmldata').AsMemo := s;

kronski
Posts: 2
Joined: Fri 06 Dec 2013 14:07

Re: Blob truncated with oracle odbc 11.02

Post by kronski » Mon 09 Dec 2013 12:38

Hi,

Thanks that solved my issues. :D

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Blob truncated with oracle odbc 11.02

Post by AlexP » Mon 09 Dec 2013 13:37

Hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.

Post Reply