Unicode / Datasnap

Unicode / Datasnap

Postby GMG » Wed 28 Apr 2010 16:46

Hello,

We are using the DevArt dbexpoda40.dll (4.50.0.19) driver in an application with a client-server version with direct database connections, and a soap version, which relies on a Datasnap appllication on the server to access the database. The compiler for both is Delphi 2010.

When connecting directly to the database, everything works fine, and we can read/write Unicode 16 (native Delphi) strings with no problems.

When connecting over Datasnap, there are two issues. One is that datasnap seems to use UTF8 in its soap messages, so we need to convert strings to Unicode from UTF8 when reading/writing them to the database. This works fine when using database fields using a custom descendant of TField.

The second problem, which is the real show-stopper, is that, when updating the DB using SQL strings that contain Chinese characters (like update...set column_nm='[Chinese string]'), the strings make it to the server ok, but they are converted to '????' by the time they make it into the database.

Using explicit Unicode in SQL works fine in the client/server environment. Both it and the soap server use TSqlQuery and TSqlConnection objects, and the identical SQL works fine in client/server.

Initializing the connection object and the query object identically has no effect, so it seems like it may be related to the Datasnap environment.

It doesn't seem to have anything to do with the soap transfer since I have the same problem when the SQL is hard-coded in the server code.

The driver "UseUnicode" and "Unicode Environment" are both set to "True" in the supplied DBXDevArtOracle.

Any ideas?

Thanks!

Gordon
GMG
 
Posts: 6
Joined: Wed 28 Apr 2010 16:21

Postby bork » Fri 30 Apr 2010 12:44

Hello

Unfortunately we cannot change behavior of DataSnap components. But you can generate the follow update query:
update...set column_name=:Value
Parameters will be binded as Unicode string and correct value will be posted to database.

Also make sure that you set the "UseUnicode" and "Unicode Environment" connection parameters correct:

const
coUseUnicode = TSQLConnectionOption(209); // boolean
. . .
SQLConnection1.Params.Values['UnicodeEnvironment'] := 'True';
...
SQLConnection1.SQLConnection.SetOption(coUseUnicode, Integer(True));
bork
Devart Team
 
Posts: 643
Joined: Fri 12 Mar 2010 07:55

Postby GMG » Fri 30 Apr 2010 16:04

Thanks for the info. I added "UseUnicode=True" and "UnicodeEnvironment=True" to the param list - but from your message it looks like I need to SQLConnection.SetOption for the UseUnicode option, correct?

One thing that was complicating things was we have a second soap dll to which we make non-datasnap calls, which also query the db, and that was compiled without these options set. The errors caused by one was affecting the other.

Fixing that and adding the two parameters seems, so far, to have fixed this problem.

Thanks again.
GMG
 
Posts: 6
Joined: Wed 28 Apr 2010 16:21

Postby bork » Wed 05 May 2010 09:46

Hello

You can find more detailed information about setting connection parameters in the "Readme.html" file in the "Extended driver options" section. This file located in the folder where your dbExpress driver is installed.
bork
Devart Team
 
Posts: 643
Joined: Fri 12 Mar 2010 07:55


Return to dbExpress driver for Oracle