26.1.9.2. Configuring a MyODBC DSN on Windows
To add and configure a new MyODBC data source on Windows, use
the ODBC Data Source Administrator
. The
ODBC Administrator
updates your data source
connection information. As you add data sources, the
ODBC Administrator
updates the registry
information for you.
To open the ODBC Administrator
from the
Control Panel:
Click Start
, point to
Settings
, and then click Control
Panel
.
-
On computers running Microsoft Windows 2000 or newer,
double-click Administrative Tools
, and
then double-click Data Sources (ODBC)
. On
computers running older versions of Windows, double-click
32-bit ODBC
or ODBC
.
The ODBC Data Source Administrator
dialog
box appears, as shown here:
Click Help
for detailed information about
each tab of the ODBC Data Source
Administrator
dialog box.
To add a data source on Windows:
Open the ODBC Data Source Administrator
.
In the ODBC Data Source Administrator
dialog box, click Add
. The
Create New Data Source
dialog box
appears.
-
Select MySQL ODBC 3.51 Driver
, and then
click Finish
. The MySQL ODBC
3.51 Driver - DSN Configuration
dialog box
appears, as shown here:
In the Data Source Name
box, enter the
name of the data source you want to access. It can be any
valid name that you choose.
In the Description
box, enter the
description needed for the DSN.
For Host or Server Name (or IP)
box,
enter the name of the MySQL server host that you want to
access. By default, it is localhost
.
In the Database Name
box, enter the name
of the MySQL database that you want to use as the default
database.
In the User
box, enter your MySQL
username (your database user ID).
In the Password
box, enter your password.
In the Port
box, enter the port number if
it is not the default (3306).
-
In the SQL Command
box, you can enter an
optional SQL statement that you want to issue automatically
after the connection has been established.
The final dialog looks like this:
Click OK
to add this data source.
Note: Upon clicking
OK
, the Data Sources
dialog box appears, and the ODBC
Administrator
updates the registry information. The
username and connect string that you entered become the default
connection values for this data source when you connect to it.
You can also test whether your settings are suitable for
connecting to the server using the button Test Data
Source
. This feature is available only for the MyODBC
3.51 driver. A successful test results in the following window:
A failed test results in an error:
The DSN configuration dialog also has an
Options
button. If you select it, the
following options dialog appears displaying that control driver
behavior. Refer to Section 26.1.9.4, “Connection Parameters”, for
information about the meaning of these options.
Note: The options listed under
Driver Trace Options
are disabled (grayed
out) unless you are using the debugging version of the driver
DLL.
To modify a data source on Windows:
Open the ODBC Data Source Administrator
.
Click the appropriate DSN tab.
Select the MySQL data source that you want to modify and
then click Configure
. The MySQL
ODBC 3.51 Driver - DSN Configuration
dialog box
appears.
Modify the applicable data source fields, and then click
OK
.
When you have finished modifying the information in this dialog
box, the ODBC Administrator
updates the
registry information.