10bet网址
Connectors and APIs Manual
Download this Manual
PDF (US Ltr)- 5.2Mb
PDF (A4)- 5.2Mb


5.8.4 Connector/ODBC Errors and Resolutions (FAQ)

The following section details some common errors and their suggested fix or alternative solution. If you are still experiencing problems, use the Connector/ODBC mailing list; seeSection 5.9.1, “Connector/ODBC Community Support”.

Many problems can be resolved by upgrading your Connector/ODBC drivers to the latest available release. On Windows, make sure that you have the latest versions of the Microsoft Data Access Components (MDAC) installed.

64-Bit Windows and ODBC Data Source Administrator

我have installed Connector/ODBC on Windows XP x64 Edition or Windows Server 2003 R2 x64. The installation completed successfully, but the Connector/ODBC driver does not appear inODBC Data Source Administrator.

This is not a bug, but is related to the way Windows x64 editions operate with the ODBC driver. On Windows x64 editions, the Connector/ODBC driver is installed in the%SystemRoot%\SysWOW64folder. However, the defaultODBC Data Source Administratorthat is available through theAdministrative ToolsorControl Panelin Windows x64 Editions is located in the%SystemRoot%\system32folder, and only searches this folder for ODBC drivers.

On Windows x64 editions, use the ODBC administration tool located at%SystemRoot%\SysWOW64\odbcad32.exe,这将正确定位安装连接or/ODBC drivers and enable you to create a Connector/ODBC DSN.

This issue was originally reported as Bug #20301.

Error 10061 (Cannot connect to server)

When connecting or using theTestbutton inODBC Data Source Administrator我get error 10061 (Cannot connect to server)

This error can be raised by a number of different issues, including server problems, network problems, and firewall and port blocking problems. For more information, seeCan't connect to [local] MySQL server.

"Transactions are not enabled" Error

The following error is reported when using transactions:交易are not enabled

This error indicates that you are trying to usetransactionswith a MySQL table that does not support transactions. Transactions are supported within MySQL when using the我nnoDBdatabase engine, which is the default storage engine in MySQL 5.5 and higher. In versions of MySQL before MySQL 5.1, you may also use theBDBengine.

Check the following before continuing:

  • Verify that your MySQL server supports a transactional database engine. Use显示引擎to obtain a list of the available engine types.

  • Verify that the tables you are updating use a transactional database engine.

  • Ensure that you have not enabled thedisable transactionsoption in your DSN.

#DELETED# Records Reported by Access

Access reports records as#DELETED#when inserting or updating records in linked tables.

我f the inserted or updated records are shown as#DELETED#in Access, then:

  • 我f you are using Access 2000, get and install the newest (version 2.6 or higher) Microsoft MDAC (Microsoft Data Access Components) fromhttp://support.microsoft.com/kb/110093. This fixes a bug in Access that when you export data to MySQL, the table and column names aren't specified.

    Also, get and apply the Microsoft Jet 4.0 Service Pack 5 (SP5), which can be found athttp://support.microsoft.com/default.aspx?scid=kb;EN-US;q239114. This fixes some cases where columns are marked as#DELETED#in Access.

  • For all versions of Access, enable the Connector/ODBCReturn matching rowsoption. For Access 2.0, also enable theSimulate ODBC 1.0option.

  • 我nclude aTIMESTAMPin all tables that you want to be able to update.

  • 我nclude aprimary keyin the table. If not, new or updated rows may show up as#DELETED#.

  • Use onlyDOUBLEfloat fields. Access fails when comparing with single-precision floats. The symptom usually is that new or updated rows may show up as#DELETED#or that you cannot find or update rows.

  • 我f you are using Connector/ODBC to link to a table that has aBIGINTcolumn, the results are displayed as#DELETED. The work around solution is:

    • Have one more dummy column withTIMESTAMPas the data type.

    • Select theChange BIGINT columns to INToption in the connection dialog in ODBC DSN Administrator.

    • Delete the table link from Access and re-create it.

    Old records still display as#DELETED#, but newly added/updated records are displayed properly.

Write Conflicts or Row Location Errors

How do I handle Write Conflicts or Row Location errors?

我f you see the following errors, select theReturn Matching Rowsoption in the DSN configuration dialog, or specifyOPTION=2, as the connection parameter:

Write Conflict. Another user has changed your data. Row cannot be located for updating. Some values may have been changed since it was last read.

我mporting from Access 97

Exporting data from Access 97 to MySQL reports aSyntax Error.

This error is specific to Access 97 and versions of Connector/ODBC earlier than 3.51.02. Update to the latest version of the Connector/ODBC driver to resolve this problem.

我mporting from Microsoft DTS

Exporting data from Microsoft DTS to MySQL reports aSyntax Error.

This error occurs only with MySQL tables using theTEXTorVARCHARdata types. You can fix this error by upgrading your Connector/ODBC driver to version 3.51.02 or higher.

SQL_NO_DATA Exception from ODBC.NET

Using ODBC.NET with Connector/ODBC, while fetching empty string (0 length), it starts giving theSQL_NO_DATAexception.

You can get the patch that addresses this problem fromhttp://support.microsoft.com/default.aspx?scid=kb;EN-US;q319243.

Error with SELECT COUNT(*)

UsingSELECT COUNT(*) FROMtbl_namewithin Visual Basic and ASP returns an error.

This error occurs because theCOUNT(*)expression is returning aBIGINT, and ADO cannot make sense of a number this big. Select theChange BIGINT columns to INToption (option value 16384).

Multiple-Step Operation Error

Using theAppendChunk()orGetChunk()ADO methods, theMultiple-step operation generated errors. Check each status valueerror is returned.

TheGetChunk()andAppendChunk()methods from ADO do not work as expected when the cursor location is specified asadUseServer. On the other hand, you can overcome this error by usingadUseClient.

A simple example can be found fromhttp://www.dwam.net/iishelp/ado/docs/adomth02_4.htm

Modified Record Error

Access returnsAnother user had modified the record that you have modifiedwhile editing records on a Linked Table.

我n most cases, this can be solved by doing one of the following things:

  • Add aprimary keyfor the table if one doesn't exist.

  • Add a timestamp column if one doesn't exist.

  • Only use double-precision float fields. Some programs may fail when they compare single-precision floats.

我f these strategies do not help, start by making a log file from the ODBC manager (the log you get when requesting logs from ODBCADMIN) and a Connector/ODBC log to help you figure out why things go wrong. For instructions, seeSection 5.5.8, “Getting an ODBC Trace File”.

Direct Application Linking Under Unix or Linux

When linking an application directly to the Connector/ODBC library under Unix or Linux, the application crashes.

Connector/ODBC under Unix or Linux is not compatible with direct application linking. To connect to an ODBC source, use a driver manager, such asiODBCorunixODBC.

Microsoft Office and DATE or TIMESTAMP Columns

Applications in the Microsoft Office suite cannot update tables that haveDATEorTIMESTAMPcolumns.

This is a known issue with Connector/ODBC. Ensure that the field has a default value (rather thanNULL) and that the default value is nonzero (that is, something other than0000-00-00 00:00:00).

我NFORMATION_SCHEMA Database

When connecting Connector/ODBC 5.x to a MySQL 4.x server, the error1044 Access denied for user 'xxx'@'%' to database 'information_schema'is returned.

Connector/ODBC 5.x is designed to work with MySQL 5.0 or later, taking advantage of the我NFORMATION_SCHEMAdatabase to determine data definition information. Support for MySQL 4.1 is planned for the final release.

S1T00 Error

When callingSQLTables,errorS1T00is returned, but I cannot find this in the list of error numbers for Connector/ODBC.

TheS1T00error indicates that a general timeout has occurred within the ODBC system and is not a MySQL error. Typically it indicates that the connection you are using is stale, the server is too busy to accept your request or that the server has gone away.

"Table does not exist" Error in Access 2000

When linking to tables in Access 2000 and generating links to tables programmatically, rather than through the table designer interface, you may get errors about tables not existing.

There is a known issue with a specific version of themsjet40.dllthat exhibits this issue. The version affected is 4.0.9025.0. Reverting to an older version will enable you to create the links. If you have recently updated your version, check yourWINDOWSdirectory for the older version of the file and copy it to the drivers directory.

Batched Statements

当我尝试使用批处理语句,不断n of the batched statements fails.

Batched statement support was added in 3.51.18. Support for batched statements is not enabled by default. Enable optionFLAG_MULTI_STATEMENTS, value 67108864, or select theAllow multiple statementsflag within a GUI configuration. Batched statements using prepared statements is not supported in MySQL.

Packet Errors with ADODB and Excel

When connecting to a MySQL server using ADODB and Excel, occasionally the application fails to communicate with the server and the errorGot an error reading communication packetsappears in the error log.

This error may be related to Keyboard Logger 1.1 from PanteraSoft.com, which is known to interfere with the network communication between MySQL Connector/ODBC and MySQL.

Outer Join Error

When using some applications to access a MySQL server using Connector/ODBC and outer joins, an error is reported regarding the Outer Join Escape Sequence.

This is a known issue with MySQL Connector/ODBC which is not correctly parsing the "Outer Join Escape Sequence", as per the specs atMicrosoft ODBC Specs. Currently, Connector/ODBC will return a value > 0 when asked forSQL_OJ_CAPABILITIESeven though no parsing takes place in the driver to handle the outer join escape sequence.

Hebrew/CJK Characters

我can correctly store extended characters in the database (Hebrew/CJK) using Connector/ODBC 5.1, but when I retrieve the data, the text is not formatted correctly and I get garbled characters.

When using ASP and UTF8 characters, add the following to your ASP files to ensure that the data returned is correctly encoded:

Response.CodePage = 65001 Response.CharSet = "utf-8"

Duplicate Entry in Installed Programs List

我have a duplicate MySQL Connector/ODBC entry within my我nstalled Programslist, but I cannot delete one of them.

This problem can occur when you upgrade an existing Connector/ODBC installation, rather than removing and then installing the updated version.

Warning

To fix the problem, use any working uninstallers to remove existing installations; then may have to edit the contents of the registry. Make sure you have a backup of your registry information before attempting any editing of the registry contents.

Values Truncated to 255 Characters

When submitting queries with parameter binding usingUPDATE, my field values are being truncated to 255 characters.

Ensure that theFLAG_BIG_PACKETSoption is set for your connection. This removes the 255 character limitation on bound parameters.

Disabling Data-At-Execution

我s it possible to disable data-at-execution using a flag?

我f you do not want to use data-at-execution, remove the corresponding calls. For example:

SQLLEN ylen = SQL_LEN_DATA_AT_EXEC(10); SQLBindCol(hstmt,2,SQL_C_BINARY, buf, 10, &ylen);

Would become:

SQLBindCol(hstmt,2,SQL_C_BINARY, buf, 10, NULL);

This example also replaced &ylen with NULL in the call toSQLBindCol().

For further information, refer to theMSDN documentationforSQLBindCol().

NULLABLE Attribute for AUTO_INCREMENT Columns

When you callSQLColumns()for a table column that isAUTO_INCREMENT,NULLABLEcolumn of the result set is alwaysSQL_NULLABLE (1).

This is because MySQL reports theDEFAULTvalue for such a column asNULL. It means, if you insert aNULLvalue into the column, you will get the next integer value for the table'sauto_incrementcounter.