Creating a Data Source Name

When connecting to your data store using a DSN, you only need to configure the odbc.ini file. Set the properties in the odbc.ini file to create a DSN that specifies the connection information for your data store. For information about configuring a DSN-less connection instead, see Configuring a DSN-less Connection.

If your machine is already configured to use an existing odbc.ini file, then update that file by adding the settings described below. Otherwise, copy the odbc.ini file from the Setup subfolder in the connector installation directory to the home directory, and then update the file as described below.

To create a Data Source Name:

  1. In a text editor, open the odbc.ini configuration file.

    Note: If you are using a hidden copy of the odbc.ini file, you can remove the period (.) from the start of the file name to make the file visible while you are editing it.

  2. In the [ODBC Data Sources] section, add a new entry by typing a name for the DSN, an equal sign (=), and then the name of the connector.
  3. Create a section that has the same name as your DSN, and then specify configuration options as key-value pairs in the section:
    1. Set the Driver property to the full path of the connector library file that matches the bitness of the application.
    2. Set the Server property to the IP address or host name of the server, and then set the Port property to the number of the TCP port that the server uses to listen for client connections.

      For example:

      Server=192.168.222.160

      Port=3306

    3. Set the UID property to an appropriate user name for accessing the MySQL database.
    4. For example:

      UID=simba

    5. If you are required to authenticate the connection using the native, caching_sha2_password, or SHA-256 authentication plugin, then set the PWD property to the password corresponding to the user name you specified above.

      For example:

      PWD=simba123

    6. Optionally, if you are authenticating the connection using the caching_sha2_password or SHA-256 authentication plugin, specify an RSA public key for encrypting your password by setting the RSAKey property to the full path and name of the file containing the key.

      For example:

      RSAKey=/localhome/simba/authentication/mysql_rsa.pem

    7. If you want to enable encryption and identity verification using SSL, then enable SSL and specify the certificate information. For more information, see Configuring SSL Connections.
    8. Optionally, set additional key-value pairs as needed to specify other optional connection settings. For detailed information about all the configuration options supported by the Simba MySQL ODBC Driver, see Driver Configuration Options.
  4. Save the odbc.ini configuration file.

    Note: If you are storing this file in its default location in the home directory, then prefix the file name with a period (.) so that the file becomes hidden. If you are storing this file in another location, then save it as a non-hidden file (without the prefix), and make sure that the ODBCINI environment variable specifies the location. For more information, see Specifying the Locations of the Connector Configuration Files.

    You can now use the DSN in an application to connect to the data store.