Page 1 of 1

D2010: UseUnicode option must be set to True ...

Posted: Tue 26 Oct 2010 17:57
by rwerning
We're using the latest version of D2010 and DbxOda v.4.50.21.

Because of an issue with have with consistency between the DbxSda & DbxOda drivers, we need to turn Unicode off. I've set the driver options in the Ini file to UseUnicode=False and UnicodeEnvironment=False.

The first time you make a connection, it works fine. If you set SqlConnection1.Connected = false, then back to true, it raises the error 'UseUnicode option must be set to True for Unicode OCI environment'.

I saw the Extended Driver Options in the Readme.html file, from how I interpret the info there, because we're using D2010 I don't have to do the SQLConnection.SetOption in the AfterOpen, it's ok to just set Params.Value[UnicodeEnvironment'] := 'False';

Do I have this correct? If so, why would it connect fine the first time, but a subsequent disconnect and connect causes the error to occur?

Any help or insight you might have would be greatly appreciated,
- Rich Werning

Posted: Thu 28 Oct 2010 07:25
by AlexP
Hello,

This problem is connected with the fact that the global OraCall.OCIUnicode (UnicodeEnvironment) variable is initialized only at the first connect and if it is set to true you can't set the UseUnicode option to false.
To resolve the problem, you should set the UnicodeEnvironment option to false before the first connect.
We will consider the possibility to change such behavior.

Posted: Thu 28 Oct 2010 18:25
by rwerning
Thank you for your response.

I'm not sure that I understand you correctly. I am setting the UnicodeEnvironment=False in the configuration files, and that loads before we do the connect. How do I need to set it otherwise?

Posted: Fri 29 Oct 2010 07:12
by AlexP
Hello,

Please check that you really set the UnicodeEnvironment and UseUnicode options to false before first connect, for example, in the following way:

procedure TForm1.SQLConnection1BeforeConnect(Sender: TObject);
begin
ShowMessage('UseUnicode: '+SQLConnection1.Params.Values['UseUnicode']);
ShowMessage('UnicodeEnvironment: '+SQLConnection1.Params.Values['UnicodeEnvironment']);
end;

Posted: Fri 29 Oct 2010 20:53
by rwerning
I made a test case using just a sqlconnection, and setting all the params in a button click event, it seems to work fine - just as you described.

Somewhere along the code path the params are getting messed with. It's odd.. it is being set, but it isn't.. If I run our app and evaluate the params in debugger they show ok, but if I use the showmessage after connect the params don't contain a value, however I can evaluate them and they have one.

I'll research more.. if there's anything more interesting than some stupid coding error I'll follow up with more details.

Thanks again for your help.

Posted: Fri 29 Oct 2010 21:24
by rwerning
Solved it. We were loading the params before setting the DriverName. When you assign the drivername it blanks out the params list, so this was causing the UnicodeEnvironment to be cleared.

Thanks for helping me solve this nagging problem.

Posted: Mon 01 Nov 2010 08:08
by AlexP
Hello,

It is good to see that this problem was solved. If any other questions come up, please contact us.