Page 1 of 1

Problem with Oracle Character Sets

Posted: Thu 15 Apr 2010 12:00
by chkaufmann
Hi,

to get correct data from blob fields, I have to set the CharSet. Doing this, I have to connect first, then disconnect, set the option and then connect again.

Is there another way to do this?

cu Christian

---

const
CHARSET_SQL = 'select VALUE from NLS_DATABASE_PARAMETERS where parameter = ''NLS_CHARACTERSET''';

function ExecLookupString(): String;
begin
// does a query and returns the result of the first record / column as string
// for this, the connection is already opened once
end;

then I do:

UniConnection.ProviderName := 'Oracle';
UniConnection.Server := 'DBSERVER:1521:MyDB';
UniConnection.SpecificOptions.Values['Direct'] := 'True';
UniConnection.SpecificOptions.Values['Charset'] := ExecLookupString(CHARSET_SQL);
UniConnection.Open;

Posted: Fri 16 Apr 2010 12:52
by bork
Hello

Yes, you can use the method you've described before. Also you can set the property TOraSession.Options.UseUnicode = true for saving and loading blob fields in the unicode.

Posted: Fri 16 Apr 2010 15:29
by chkaufmann
bork wrote:property TOraSession.Options.UseUnicode = true for saving and loading blob fields in the unicode.
Can you be more specific? There is no TOraSession in UniDAC.

I tried

UniConnection.SpecificOptions.Values['UseUnicode'] := 'True';

instead of setting the 'Charset', but this doesn't work.


cu Christian

Posted: Mon 19 Apr 2010 12:32
by bork
Oracle server saves Blob fields as binary data and doesn't have any info about the charset of Blob fields. So if you don't want to depend on server charset then you should convert string to unicode string on write and read data for the Blob fields manually.

But if you want to use server converting string to unicode string and back then you should use Clob fields.