Documentation Home
Connectors and APIs Manual
Download this Manual

6.7.2 Connector/ODBC Data Types

The following table illustrates how Connector/ODBC maps the server data types to default SQL and C data types.

Table 6.16 How Connector/ODBC Maps MySQL Data Types to SQL and C Data Types

Native Value SQL Type C Type
bigint unsigned SQL_BIGINT SQL_C_UBIGINT
bigint SQL_BIGINT SQL_C_SBIGINT
bit SQL_BIT SQL_C_BIT
bit SQL_CHAR SQL_C_CHAR
blob SQL_LONGVARBINARY SQL_C_BINARY
bool SQL_CHAR SQL_C_CHAR
char SQL_CHAR SQL_C_CHAR
date SQL_DATE SQL_C_DATE
datetime SQL_TIMESTAMP SQL_C_TIMESTAMP
decimal SQL_DECIMAL SQL_C_CHAR
double precision SQL_DOUBLE SQL_C_DOUBLE
double SQL_FLOAT SQL_C_DOUBLE
enum SQL_VARCHAR SQL_C_CHAR
float SQL_REAL SQL_C_FLOAT
int unsigned SQL_INTEGER SQL_C_ULONG
int SQL_INTEGER SQL_C_SLONG
integer unsigned SQL_INTEGER SQL_C_ULONG
integer SQL_INTEGER SQL_C_SLONG
long varbinary SQL_LONGVARBINARY SQL_C_BINARY
long varchar SQL_LONGVARCHAR SQL_C_CHAR
longblob SQL_LONGVARBINARY SQL_C_BINARY
longtext SQL_LONGVARCHAR SQL_C_CHAR
mediumblob SQL_LONGVARBINARY SQL_C_BINARY
mediumint unsigned SQL_INTEGER SQL_C_ULONG
mediumint SQL_INTEGER SQL_C_SLONG
mediumtext SQL_LONGVARCHAR SQL_C_CHAR
numeric SQL_NUMERIC SQL_C_CHAR
real SQL_FLOAT SQL_C_DOUBLE
set SQL_VARCHAR SQL_C_CHAR
smallint unsigned SQL_SMALLINT SQL_C_USHORT
smallint SQL_SMALLINT SQL_C_SSHORT
text SQL_LONGVARCHAR SQL_C_CHAR
time SQL_TIME SQL_C_TIME
timestamp SQL_TIMESTAMP SQL_C_TIMESTAMP
tinyblob SQL_LONGVARBINARY SQL_C_BINARY
tinyint unsigned SQL_TINYINT SQL_C_UTINYINT
tinyint SQL_TINYINT SQL_C_STINYINT
tinytext SQL_LONGVARCHAR SQL_C_CHAR
varchar SQL_VARCHAR SQL_C_CHAR
year SQL_SMALLINT SQL_C_SHORT


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.