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

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
rwerning
Posts: 17
Joined: Wed 20 Feb 2008 21:09

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

Post by rwerning » Tue 26 Oct 2010 17:57

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

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

Post by AlexP » Thu 28 Oct 2010 07:25

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.

rwerning
Posts: 17
Joined: Wed 20 Feb 2008 21:09

Post by rwerning » Thu 28 Oct 2010 18:25

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?

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

Post by AlexP » Fri 29 Oct 2010 07:12

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;

rwerning
Posts: 17
Joined: Wed 20 Feb 2008 21:09

Post by rwerning » Fri 29 Oct 2010 20:53

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.

rwerning
Posts: 17
Joined: Wed 20 Feb 2008 21:09

Post by rwerning » Fri 29 Oct 2010 21:24

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.

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

Post by AlexP » Mon 01 Nov 2010 08:08

Hello,

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

Post Reply