Hi,
I am trying unicode enable an old Delphi 5 app and am having trouble writing unicode to the database. The database is 11g and the characterset is AL32UTF8. I have downloaded the latest version of ODAC for d5 - 6.90. If i use ADO it works fine, but i need to use ODAC with direct connect so there is no need for drivers on the client machines.
The following is a sample of the query i am running...
OraSession.Options.UseUnicode := True;
OraSession.Options.Charset := 'AL32UTF8';
with qryUpdate do
begin
close;
sql.clear;
sql.add('update TEST_TABLE set name = :nme where id = :myid');
ParamByName('nme').value := edELName.text;
ParamByName('myid').value := edELID.text;
execsql;
end;
I have tried using ParamByName('nme').aswidestring and that doesn't help - database is showing ? for the unicode characters. The datatype in the table for the unicode string is NVARCHAR2. Please can you help with this as i am stuck.
thanks,
jp
Updating Unicode through TOraQuery
Hello
You have tried setting params as non-unicode string. And if you set OraSession.Options.Charset differ from server charset then you save text in the invalid charset to database and get one or more "?" instead of your string.
I can propose two ways to solve your issue:
1. Set OraSession.Options.Charset equal to database charset or try setting OraSession.Options.Charset to empty value.
2. Set params as unicode string:
ParamByName('nme').DataType := ftWideString;
ParamByName('nme').Value := edELName.Text;
You have tried setting params as non-unicode string. And if you set OraSession.Options.Charset differ from server charset then you save text in the invalid charset to database and get one or more "?" instead of your string.
I can propose two ways to solve your issue:
1. Set OraSession.Options.Charset equal to database charset or try setting OraSession.Options.Charset to empty value.
2. Set params as unicode string:
ParamByName('nme').DataType := ftWideString;
ParamByName('nme').Value := edELName.Text;
Hi,
Thanks for the suggestions. I tried various options without success. I then created a quick test app in Delphi 2010 with the trial ODAC and it worked fine with the following code:
oraSession.Options.UseUnicode := True;
with qryUpdate do
begin
close;
sql.clear;
sql.add('update TEST set name = :nme where id = :myid');
ParamByName('nme').value := edName.text;
ParamByName('myid').value := edID.text;
execsql;
end;
I will therefore move my project to the latest Delphi, but looks like there is an issue with D5.
thanks,
jp
Thanks for the suggestions. I tried various options without success. I then created a quick test app in Delphi 2010 with the trial ODAC and it worked fine with the following code:
oraSession.Options.UseUnicode := True;
with qryUpdate do
begin
close;
sql.clear;
sql.add('update TEST set name = :nme where id = :myid');
ParamByName('nme').value := edName.text;
ParamByName('myid').value := edID.text;
execsql;
end;
I will therefore move my project to the latest Delphi, but looks like there is an issue with D5.
thanks,
jp