Spec-Zone .ru
спецификации, руководства, описания, API

22.1.4.3. Configuring a Connector/ODBC DSN on Windows

The ODBC Data Source Administrator within Windows lets you create DSNs, check driver installation and configure ODBC systems such as tracing (used for debugging) and connection pooling.

Different editions and versions of Windows store the ODBC Data Source Administrator in different locations depending on the version of Windows that you are using.

To open the ODBC Data Source Administrator in Windows Server 2003:

Tip

To identify whether a DSN was created using the 32-bit or the 64-bit driver, include the driver being used within the DSN identifier. This will help you to identify the right DSN to use with applications such as Excel that are only compatible with the 32-bit driver. For example, you might add Using32bitCODBC to the DSN identifier for the 32-bit interface and Using64bitCODBC for those using the 64-bit Connector/ODBC driver.

  1. On the Start menu, choose Administrative Tools, and then click Data Sources (ODBC).

To open the ODBC Data Source Administrator in Windows 2000 Server or Windows 2000 Professional:

  1. On the Start menu, choose Settings, and then click Control Panel.

  2. In Control Panel, click Administrative Tools.

  3. In Administrative Tools, click Data Sources (ODBC).

To open the ODBC Data Source Administrator on Windows XP:

  1. On the Start menu, click Control Panel.

  2. In the Control Panel when in Category View click Performance and Maintenance and then click Administrative Tools.. If you are viewing the Control Panel in Classic View, click Administrative Tools.

  3. In Administrative Tools, click Data Sources (ODBC).

Irrespective of your Windows version, you should be presented the ODBC Data Source Administrator window:

ODBC Data Source Administrator Dialog

Within Windows XP, you can add the Administrative Tools folder to your Start menu to make it easier to locate the ODBC Data Source Administrator. To do this:

  1. Right-click the Start menu.

  2. Select Properties.

  3. Click Customize....

  4. Select the Advanced tab.

  5. Within Start menu items, within the System Administrative Tools section, select Display on the All Programs menu.

Within both Windows Server 2003 and Windows XP, consider permanently adding the ODBC Data Source Administrator to your Start menu. To do this, locate the Data Sources (ODBC) icon using the methods shown, then right-click on the icon and then choose Pin to Start Menu.

The interfaces for the 3.51 and 5.x versions of the Connector/ODBC driver are different, although the fields and information that you need to enter remain the same.

To configure a DSN using Connector/ODBC 5.2, see Section 22.1.4.3.1, "Configuring a Connector/ODBC 5.x DSN on Windows".

22.1.4.3.1. Configuring a Connector/ODBC 5.x DSN on Windows

Due to the native Unicode support within Connector/ODBC, you do not need to specify the initial character set to be used with your connection.

To add or configure a Connector/ODBC 5.x DSN on Windows, use either the command-line, or the ODBC Data Source Administrator GUI.

  1. Open the ODBC Data Source Administrator.

  2. To create a System DSN (which will be available to all users), select the System DSN tab. To create a User DSN, which will be unique only to the current user, click the Add... button.

  3. Select the ODBC driver for this DSN.

    MySQL ODBC Driver Selection Dialog

    Select MySQL ODBC 5.x Driver for the appropriate level of Connector/ODBC, then click Finish.

  4. You now need to configure the specific fields for the DSN you are creating through the Connection Parameters dialog.

    Add Data Source Name Dialog for Connector/ODBC 5.2

    In the Data Source Name box, enter the name of the data source to access. It can be any valid name that you choose.

  5. In the Description box, enter some text to help identify the connection.

  6. In the Server field, enter the name of the MySQL server host to access. By default, it is localhost.

  7. In the User field, enter the user name to use for this connection.

  8. In the Password field, enter the corresponding password for this connection.

  9. The Database pop-up should automatically populate with the list of databases that the user has permissions to access.

  10. To communicate over a different TCP/IP port than the default (3306), change the value of the Port.

  11. Click OK to save the DSN.

To verify the connection using the parameters you have entered, click the Test button. If the connection could be made successfully, you will be notified with a Success; connection was made! dialog.

You can configure a number of options for a specific DSN by using the Details button.

Connector/ODBC Connect Options Dialog

The Details button opens a tabbed display where you set additional options:

  • Flags 1, Flags 2, and Flags 3 enable you to select the additional flags for the DSN connection. For more information on these flags, see Section 22.1.4.2, "Connector/ODBC Connection Parameters".

  • Debug lets you turn on ODBC debugging to record the queries you execute through the DSN to the myodbc.sql file. For more information, see Section 22.1.4.8, "Getting an ODBC Trace File".

  • SSL Settings configures the additional options required for using the Secure Sockets Layer (SSL) when communicating with MySQL server. Note that you must also enable SSL and configure the MySQL server with suitable certificates to communicate over SSL.

    Connector/ODBC 5.2 SSL Configuration

The Advanced tab lets you configure Connector/ODBC connection parameters. Refer to Section 22.1.4.2, "Connector/ODBC Connection Parameters", for information about the meaning of these options.

22.1.4.3.2. Configuring a Connector/ODBC 5.x DSN on Windows, Using the Command Line

Use myodbc-installer.exe when configuring Connector/ODBC 5.1 or later from the command-line.

Execute myodbc-installer.exe without arguments to view a list of available options.

22.1.4.3.3. Troubleshooting ODBC Connection Problems

This section answers Connector/ODBC connection-related questions.

  • While configuring a Connector/ODBC DSN, a Could Not Load Translator or Setup Library error occurs

    For more information, refer to MS KnowledgeBase Article(Q260558). Also, make sure you have the latest valid ctl3d32.dll in your system directory.

  • On Windows, the default myodbc5w.dll (Unicode) or myodbc5a.dll (ANSI) is compiled for optimal performance. To debug Connector/ODBC (for example, to enable tracing), instead use myodbc5d.dll. To install this file, copy myodbc5d.dll over the installed myodbc5w.dll or myodbc5a.dll file. Make sure to revert back to the release version of the driver DLL once you are done with the debugging, because the debug version may cause performance issues.