Thu 22 Dec 2016

I am ashamed!

Categories : Thoughts / Lessons
Comments here
Fri 2 Dec 2016

 

Just in case if Arabic characters appearing as ????? in your column and if you are using MySql DB along with .NET Provider, 

Check below properties of schema, table and column and connectionstring that use to connect to DB

  1. DEFAULT_CHARACTER_SET_NAME = utf8
  2. DEFAULT_COLLATION_NAME = utf8_general_ci
  3. TABLE_COLLATION = utf8_general_ci
  4. COLLATION_NAME = utf8_general_ci
  5. CHARACTER_SET_NAME = utf8
  6. .NET Connection string set to have = 'charset=utf8'

 

Connection string example

'datasource=<server>;port=3306;username=<userid>;password=<password>;sslmode=none;database=<dbname>;charset=utf8'

 

Queries that may help to find above information are 

SELECT * FROM information_schema.SCHEMATA S

WHERE schema_name = "<database-name>";

 

SELECT * FROM information_schema.`TABLES` T,

information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA

WHERE CCSA.collation_name = T.table_collation

AND T.table_schema = "<database-name>"

AND T.table_name = "<table-name>";

  

SELECT * FROM information_schema.`COLUMNS` C

WHERE table_schema = "<database-name>"

AND table_name = "<table-name>"

AND column_name = "<column-name>";

 

Comments here