The Easysoft ODBC-MySQL Driver is installed on the computer where your applications are running. ODBC applications access ODBC drivers through the ODBC Driver Manager and a data source. The data source tells the Driver Manager which ODBC driver to load, which MySQL server to connect to and how to connect to it. This chapter describes how to create data sources, use DSN-less connections and configure the Easysoft ODBC-MySQL Driver.
Before setting up a data source, you must have successfully installed the Easysoft ODBC-MySQL Driver.
For Easysoft ODBC-MySQL Driver installation instructions, see Installation.
This section describes how to configure the Easysoft ODBC-MySQL Driver to connect to a MySQL database by using a data source or a DSN-less connection string. The section assumes you are, or are able to consult with, a database administrator.
Refer to the section relevant to your platform to continue:
There are two ways to set up a data source to your MySQL data:
By default, the Easysoft ODBC-MySQL Driver installation creates a SYSTEM data source named [MYSQL_SAMPLE]. If you are using the unixODBC included in the Easysoft ODBC-MySQL Driver distribution, the SYSTEM odbc.ini file is in /etc.
If you built unixODBC yourself, or installed it from some other source, SYSTEM data sources are stored in the path specified with the configure option --sysconfdir=directory. If sysconfdir was not specified when unixODBC was configured and built, it defaults to /usr/local/etc.
If you accepted the default choices when installing the Easysoft ODBC-MySQL Driver, USER data sources must be created and edited in $HOME/.odbc.ini.
To display the directory where unixODBC stores SYSTEM and USER data sources, type odbcinst -j. By default, you must be logged in as root to edit a SYSTEM data source defined in /etc/odbc.ini. |
You can either edit the sample data source or create new data sources.
Each section of the odbc.ini file starts with a data source name in square brackets [ ] followed by a number of attribute=value pairs.
Attribute names in odbc.ini are not case sensitive. |
The Driver attribute identifies the ODBC driver in the odbcinst.ini file to use for a data source.
When the Easysoft ODBC-MySQL Driver is installed into unixODBC, it places an Easysoft ODBC-MySQL entry in odbcinst.ini. For Easysoft ODBC-MySQL Driver data sources therefore, you need to include a Driver = Easysoft ODBC-MySQL entry.
To configure a MySQL data source, in your odbc.ini file, you need to specify:
The Easysoft ODBC-MySQL Driver must be able to find the following shared objects, which are installed during the Easysoft ODBC-MySQL Driver installation:
By default, this is located in /usr/local/easysoft/unixODBC/lib.
By default, this is located in /usr/local/easysoft/lib.
By default, this is located in /usr/local/easysoft/lib.
You may need to set and export LD_LIBRARY_PATH, SHLIB_PATH or LIBPATH (depending on your operating system and run-time linker) to include the directories where libodbcinst.so, libeslicshr.so and libessupp.so are located.
The shared object file extension (.so) may vary depending on the operating system (.so, .a or .sl). |
The isql query tool lets you test your Easysoft ODBC-MySQL Driver data sources.
To test the Easysoft ODBC-MySQL Driver connection
1. Change directory into /usr/local/easysoft/unixODBC/bin.
2. Type ./isql.sh -v data_source, where data_source is the name of the target data source.
3. At the prompt, type an SQL query. For example:
Type help to return a list of tables:
To connect an ODBC application on a Windows machine to a Salesforce database:
1. Open ODBC Data Source Administrator:
The ODBC Data Source Administrator dialog box is displayed:
2. Select the User DSN tab to set up a data source that only you can access.
Select the System DSN tab to create a data source which is available to anyone who logs on to this Windows machine.
3. Click Add... to add a new data source.
The Create New Data Source dialog box displays a list of drivers:
4. Select Easysoft ODBC-MySQL Driver and click Finish.
The Easysoft ODBC-MySQL Driver DSN Setup dialog box is displayed:
For details of the attributes that can be set on this dialog box, see Attribute Fields.
The Easysoft installer program installs both a 32-bit and a 64-bit version of the Easysoft ODBC-MySQL Driver. If you want to use a 64-bit ODBC application, you need to use the 64-bit Easysoft ODBC-MySQL Driver. If you want to use a 32-bit ODBC application, you need to use the 32-bit Easysoft ODBC-MySQL Driver. There is both a 32-bit and a 64-bit version of ODBC Administrator. The 64-bit ODBC Administrator is located in Control Panel under Administrative tools. To access the 32-bit ODBC Administrator in Windows 7 and earlier, in the Windows Run dialog box, type: %windir%\syswow64\odbcad32.exe On Windows 8, both the 32-bit and 64-bit ODBC Administrator are located in Control Panel under Administrative tools: ODBC Data Sources (32-bit) and ODBC Data Sources (64-bit). Easysoft ODBC-MySQL Driver data sources created in the 64-bit ODBC Administrator will specify the 64-bit version of the Easysoft ODBC-MySQL Driver. Easysoft ODBC-MySQL Driver data sources created in the 32-bit ODBC Administrator will specify the 32-bit version of the Easysoft ODBC-MySQL Driver. If you want to create an Easysoft ODBC-MySQL Driver System data source for use with a 64-bit application, use the 64-bit ODBC Administrator. If you want to create an Easysoft ODBC-MySQL Driver System data source for use with a 32-bit application, use the 32-bit ODBC Administrator. For Easysoft ODBC-MySQL Driver User data sources, it does not matter which version of the ODBC Administrator that you use. |
This section lists the attributes which can be set for the Easysoft ODBC-MySQL Driver in a table showing:
Attributes which are text fields are displayed as value.
Attributes which are logical fields can contain either 0 (to set to off) or 1 (to set to on) and are displayed as "0|1".
If an attribute can contain one of several specific values then each possible entry is displayed and separated by a pipe symbol.
For example, in the statement:
the value entered may be "1", "2" or "3".
The name of the User or System data source to be created, as used by the application when calling the SQLConnect or SQLDriverConnect functions.
odbc.ini file (Unix) |
|
Descriptive text that may be retrieved by certain applications to describe the data source.
odbc.ini file (Unix) |
|
The database to to connect to. For example, to connect to the MySQL sample database set the Database attribute value to Employees.
odbc.ini file (Unix) |
|
The user name to use when connecting to MySQL. You must specify a name of a user who has access to the target MySQL server.
To specify the user name in the connection string, use UID rather than User. For more information about specifying Easysoft ODBC-MySQL Driver attributes in the connection string, see DSN-less Connections.
odbc.ini file (Unix) |
|
The password for the user name.
To specify the password in the connection string, use PWD rather than Password.
odbc.ini file (Unix) |
|
The host name or IP address of the machine on which the MySQL server is running.
odbc.ini file (Unix) |
|
The TCP port that the MySQL server is listening on.
If you are connecting to a default instance that is listening on port 3036, the Port setting can be omitted.
odbc.ini file (Unix) |
|
Set IPv6 to Yes when connecting to a MySQL instance that is listening on an IPv6 address.
By default, IPv6 is OFF (set to Yes), which means that the Easysoft ODBC-MySQL Driver assumes that the target MySQL instance is listening on an IPv4 address.
odbc.ini file (Unix) |
|
Whether the Easysoft ODBC-MySQL Driver requests an encrypted connection to MySQL.
odbc.ini file (Unix) |
|
Whether to use the compressed MySQL client server protocol. To use compression, set Compress to Yes. By default, compression is not used.
odbc.ini file (Unix) |
|
The client's private key file. For example, /etc/mysql-ssl/client-key.pem
.
odbc.ini file (Unix) |
|
The CA certificate file. For example, /etc/mysql-ssl/ca.pem
odbc.ini file (Unix) |
|
The name of the PEM file that contains the RSA public key for using the SHA256 authentication plugin. If you do not set this attribute, the MySQL Server will send its copy of the key to the Easysoft ODBC-MySQL Driver. Use this RSA Cert to avoid this process, if you have a local copy of the key on the client machine.
odbc.ini file (Unix) |
|
Whether the Easysoft ODBC-MySQL Driver tries to validate the server certificate to verify the identity of the MySQL machine. Set Trust Cert to Yes if your MySQL machine is using a self-signed SSL certificate. Otherwise, leave Trust Cert set to No and set the Certificate File flag instead.
odbc.ini file (Unix) |
|
When ON (set to Yes), the Easysoft ODBC-MySQL Driver use the MySQL Text Protocol for prepared statements. By default, the Easysoft ODBC-MySQL Driver uses the Binary Protocol for prepared statements.
odbc.ini file (Unix) |
|
When ON (set to Yes), the number of active statements allowed is limited to 1 (SQL_MAX_CONCURRENT_ACTIVITES set to 1). When OFF (set to No), the number of active statements allowed is unlimited (SQL_MAX_CONCURRENT_ACTIVITES set to 0). By default, No Cache is OFF.
odbc.ini file (Unix) |
|
Whether to convert 8-bit data to UTF-8.
odbc.ini file (Unix) |
|
The character set to use for the connection. Set this attribute to 33 (UTF-8) if you are using a UTF-8 database in MySQL 3.51.17-4.x.
odbc.ini file (Unix) |
|
When ON (set to Yes), the Easysoft ODBC-MySQL Driver sets the SQL mode to ANSI_QUOTES. In this mode, " is treated as an identifier quote character and not as a string quote character.
odbc.ini file (Unix) |
|
When ON (set to Yes), the Easysoft ODBC-MySQL Driver .
odbc.ini file (Unix) |
|
Enable Kerberos if you are using MySQL (as opposed to MariaDB) and want to use Kerberos to authenticate the Easysoft ODBC-MySQL Driver connection.
odbc.ini file (Unix) |
|
The primary part of the Kerberos Principal, if different to User.
odbc.ini file (Unix) |
|
The Kerberos Principal for the machine on which the Easysoft ODBC-MySQL Driver is installed. Specify Principle in the form instance@realm. For example, MYMACHINEFQDN@MYDOMAIN. You only need to specify a Kerberos Principal if you are attempting to use Kerberos with MySQL (as opposed to MariaDB).
odbc.ini file (Unix) |
|
Use NULL for invalid datetime columns.
odbc.ini file (Unix) |
|
Return MySQL TIME columns as a SQL_TIME type. By default, the Easysoft ODBC-MySQL Driver reports TIME colums as SQL_CHAR.
DSN Dialog Box (Windows) |
Not Available |
odbc.ini file (Unix) |
TimeAsTime = Yes | No |
Connect String |
TIMEASTIME = Yes | No |
In addition to using a data source, you can also connect to a database by using a DSN-less connection string of the form:
SQLDriverConnect(..."DRIVER={Easysoft ODBC-MySQL};
Server=server;UID=user;PWD=password;
where server is the host name or IP address of the machine on which the MySQL instance is running, user and password are a valid operating system user name and password and database isthe MySQL database you want to connect to. You need to use the Easysoft ODBC-MySQL DRIVER keyword to identify the Easysoft ODBC-MySQL Driver.
Other Easysoft ODBC-MySQL Driver attribute settings, as described in Setting Up Data Sources on Unix, can be added to the connection string using the same PARAMETER=value; format. For example, the following connection string connects to a MySQL server that is listening on a non-standard port.
"DRIVER={Easysoft ODBC-MySQL};Server=myhost;UID=myuser;PWD=mypassword;Database=Employees;Port=50001"
"DRIVER={Easysoft MySQL ODBC Driver};Server=myhost;UID=myuser;PWD=mypassword;Database=Employees;Port=50001"