MySQL ODBC 5.1 Set Names not allowed by driver

2019-04-16 13:07发布

问题:

I've a windows 2008 server and an asp website.

I moved site to my server from a windows 2003 server and it was working good. It uses mysql as database and Set Names 'Latin5' was it's odbc driver initial statement.

I tried to set same initial statement and I got "Set Names not allowed by driver" error message and db update/insert queries gives error.

The site is in Turkish language.

Thanks for the help..

回答1:

SET NAMES has been removed in MyODBC version 5.1. http://dev.mysql.com/doc/refman/5.1/en/connector-odbc-news-5-1-1.html

So you have a couple of options:

With MyODBC 5.1, remove all of the SET NAMES calls.

Change your DSN in ODBC to specify a character set, otherwise if you are using a DSN-less connection string, you will need to add Charset=Latin5;

Example:

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword; Charset=Latin5;

You may also need to delimit your table names, MySQL uses ` to delimit table names.

Example:

SELECT id FROM `table`;

Last option is to downgrade to MyODBC 3.51.