Bug #66946 inconsistent description of national char types between JDBC metadata methods
Submitted: 24 Sep 2012 14:27 Modified: 14 Jan 2013 19:10
Reporter: the 6campbells Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.12 OS:Any
Assigned to: CPU Architecture:Any

[24 Sep 2012 14:27] the 6campbells
Description:
MySQL accepts national character data types for columns in tables and procedure parameters etc. The respective JDBC metadata methods (getColumns, getProcedureColumns, ResultSetMetadata, getTypeInfo) should be consistent in their description of these types. 

getTypeInfo will not return any form of NATIONAL type in the vendor types to JDBC types.

getColumns will describe a national column as form of character type

getProcedureColumns will describe a procedure parameter as JDBC type 1111 with the type name of NATIONAL CHAR or NATIONAL VARCHAR etc.

How to repeat:
create table t1 ( c1 nchar (32))
create table t2 ( c1 nvarchar (32))
create procedure p1 ( IN c1 national char(32) )....
create procedure p2 ( IN c1 national varchar(32) ) ....

write a simple JDBC program to invoke the aforementioned JDBC DatabaseMetadata methods and review the JDBC type values and names returned from the various methods.
[14 Dec 2012 19:10] Sveta Smirnova
Thank you for the report.

What do you expect from c/J?

According to http://dev.mysql.com/doc/refman/5.5/en/charset-national.html NATIONAL is just synonym for CHARACTER SET utf8 MySQL command line client clearly show this:

mysql [localhost] {msandbox} (test) > create table t1 ( c1 nchar (32));
Query OK, 0 rows affected (0.13 sec)

mysql [localhost] {msandbox} (test) > show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `c1` char(32) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

So c/J does not have information about how table was defined.
[15 Jan 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".