DB2 Unicode Character Support

<< Click to Display Table of Contents >>

Navigation:  5. Detailed description of the Actions > 5.1. General Parameters used in many actions > 5.1.6. ODBC Connections > IBM DB2 Setup > DB2 Unicode Character Support


Inside Anatella, all the characters are Unicode. This means that Anatella can handle any characters (e.g. any Chinese chars, any Cyrilic chars, any accentuated chars).


By default, inside DB2, the fields that are declared as “VARCHAR()” are not Unicode. For example, this means that DB2 will report an error if you use Anatella to insert any accentuated character (such as é,è,à,…) inside a “VARCHAR()” field. The solution is to never use any “VARCHAR()” fields and always use “VARGRAPHIC()” fields instead (when you declare a new field containing some characters inside a “CREATE TABLE” statement). More details: The “VARGRAPHIC()” fields are Unicode and can accommodate any character that Anatella might want to INSERT.

To remind you: The ANATEL~2_img48 CreateTable automatically generates a “CREATE TABLE” statement based on the data contained inside the table to INSERT inside the database. Unfortunatelly, by default, inside the auto-generated “CREATE TABLE” statement, all the columns that contain some characters are declared as “VARCHAR()” and not “VARGRAPHIC()”: i.e. This won’t work properly inside DB2. This means that you must manually edit the auto-generated “CREATE TABLE” statement to replace all “VARCHAR” strings with the “VARGRAPHIC” string. Alternatively, instead of manually editing the “CREATE TABLE” statement, you can use the following JS code inside the “For Expert Users” panel of the ANATEL~2_img48 CreateTable Action:



     function run()


   var s="",i,n=columns.length,c;

   if (dropTable) s+="DROP TABLE IF EXISTS "+tableName+";\n";

   s+="CREATE TABLE "+tableName+" (\n";




       s+="  "+c.name+" ";

       if (c.declaration!=null)  s+=c.declaration;



            switch (c.type)


            case 'F':

                   if (useFloat53) s+="float(53)";

                   else                  s+="float(24)";


            case '0': case 'K':



            case 'U':



            default :




            if (pkIsNotNull&&c.isPK) s+=" NOT NULL"


       if (i+1!=n) s+=",\n";



   if (autoPK.length>0) s+=",\n  "+autoPK+" NOT NULL AUTO_INCREMENT";

   else if (listPK.length>0)



       s+=",\n  PRIMARY KEY ("+listPK[0];

       for(i=1;i<n;i++) s+=","+listPK[i];




  return s;