Previous Topic

Next Topic

Book Contents

Book Index

Unicode support with Sybase Anywhere

Configuring the Sybase Anywhere Database

In order to use Unicode in your Sybase Anywhere database, you must specify a character set of utf8 when you create the database.

Configuring the Sybase Anywhere ODBC Driver

To use Unicode, you must configure the ODBC Driver to specify a client codeset of utf8. On the ODBC Driver:

Data Types

Once the database has been defined to use utf8 encoding, all character data types can hold unicode data.

Use of Unicode Literals

During our testing with Sybase Anywhere we have have found that AQT is able to:

However, the one thing that does not appear to work is the specification of unicode literals in SQL statements. This means that statements such as the following cannot be run:

Insert into DBA.unicode_test (col1) Values('ald')

This makes it very difficult to manipulate unicode data in your database. This limitation is almost certainly due to limitations of the Sybase Anywhere ODBC Driver.

Replace unicode Strings with parameters

To avoid this limitation, AQT has an option Unicode Options > For Sybase Anywhere, replace Unicode strings with parameters. When this option is specified, AQT will scan your SQL statements for strings containing unicode values. When if finds one, it will replace the unicode string with a parameter marker, and pass the unicode string in the parameter.

For instance, when it sees:

Insert into DBA.unicode_test (col1) Values('ald')

AQT will process this as:

--aqt parms,parmno=1,value=ald
Insert into DBA.unicode_test (col1) Values(?)

This makes it very easy to use unicode data in an Sybase Anywhere database.

One limitation: if AQT finds any existing ?s (parameter markers) in your SQL, AQT will not do this string replacement.

Advanced Query Tool
© 2023 Cardett Associates Ltd. All rights reserved.