Configuring the Adapter for MySQL

In this section:

x x

Configuring the adapter consists of specifying connection and authentication information for each of the connections you want to establish.


Top of page

x
Declaring Connection Attributes

How to:

Reference:

x

The SET CONNECTION_ATTRIBUTES command allows you to declare a connection to one MySQL database server and to supply authentication attributes necessary to connect to the server.

You can declare connections to more than one MySQL database server by issuing multiple SET CONNECTION_ATTRIBUTES commands. The actual connection takes place when the first query referencing that connection is issued (see Overriding the Default Connection). You can include SET CONNECTION_ATTRIBUTES commands in an RPC or a server profile. The profile can be encrypted.

If you issue multiple SET CONNECTION_ATTRIBUTES commands:



x
Procedure: How to Declare Connection Attributes

You can configure the adapter from either the Web Console or the Data Management Console.

  1. From the Web Console menu bar, click Adapters.

    or

    From the Data Management Console, expand the Adapters folder.

    The Adapters folder opens.

  2. Expand the Available folder, if it is not already expanded.
  3. Expand the appropriate group folder and the specific adapter folder. The group folder is described in the connection attributes reference.
  4. Right-click the adapter name and/or version and select Configure.

    The Add Adapter to Configuration pane opens.

  5. Enter values for the parameters required by the adapter, as described in the connection attributes reference.
  6. Click Configure. The configured adapter is added to the Adapters list in the navigation pane.


x
Reference: Connection Attributes for MySQL

The MySQL adapter is under the SQL group folder.

The following list describes the connection attributes for which you can supply values. To complete the attribute declaration, click the Configure button.

Connection name

Logical name used to identify this particular set of connection attributes. The default is CON01.

URL

Enter the location URL for the MySQL data source. The basic syntax is

jdbc:mysql://host/database

where:

host

Is the computer name or IP address on which the MySQL database is located.

database

Is the name of the database.

These are two examples:

jdbc:mysql://localhost/qatst
jdbc:mysql://edaaix52/qatst

Beginning with MySQL Release 4.1, you can reference additional MySQL connection properties in the URL. If you wish to do so, follow these guidelines: in the URL the first property must be preceded by the ? character, and the second and subsequent properties referenced in the URL must be preceded by the & character followed immediately by an | character, as illustrated in the following example.

Suppose that you wish to add the following connection properties:

sessionVariables=sql_mode=PIPES_AS_CONCAT
 zeroDateTimeBehavior=convertToNull

Enter the URL as follows:

jdbc:mysql://host/database?sessionVariables=sql_mode=P
IPES_AS_CONCAT&| 
 zeroDateTimeBehavior=convertToNull

Note: The URL must be entered as a single line, without a space after the | character.

Driver name

Name of the Microsoft JDBC driver: com.mysql.jdbc.Driver

Security

There are two methods by which a user can be authenticated when connecting to a database server:

  • Explicit. The user ID and password are explicitly specified for each connection and passed to the database, at connection time, for authentication.
  • Password Passthru. The user ID and password received from the client application are passed to the database, at connection time, for authentication.
User

Primary authorization ID by which you are known to the data source.

Password

Password associated with the primary authorization ID.

Select profile

Select a profile from the drop-down menu to indicate the level of profile in which to store the CONNECTION_ATTRIBUTES command. The global profile, edasprof.prf, is the default.

If you wish to create a new profile, either a user profile (user.prf) or a group profile if available on your platform (using the appropriate naming convention), choose New Profile from the drop-down menu and enter a name in the Profile Name field (the extension is added automatically).

Store the connection attributes in the server profile (edasprof).



x
Syntax: How to Declare Connection Attributes Manually

For explicit authentication:

ENGINE MYSQL SET CONNECTION_ATTRIBUTES [connection]/userid,password

For password passthru authentication:

ENGINE MYSQL SET CONNECTION_ATTRIBUTES connection/

where:

MYSQL

Indicates the adapter. You can omit this value if you previously issued the SET SQLENGINE command.

connection

The name of the connection. You can give any name to the connection that you want.

userid

Is the primary authorization ID by which you are known to MySQL.

password

Is the password associated with the primary authorization ID.



Example: Declaring Connection Attributes

The following SET CONNECTION_ATTRIBUTES command connects to the MySQL database server named TEST with an explicit user ID and password:

ENGINE MYSQL SET CONNECTION_ATTRIBUTES TEST/USERA,PWDA

The following SET CONNECTION_ATTRIBUTES command connects to the MySQL database server named TEST using password passthru authentication:

ENGINE MYSQL SET CONNECTION_ATTRIBUTES TEST/

Top of page

x
Authenticating a User
x

There are two methods by which a user can be authenticated when connecting to a MySQL database server:

When a client connects to the server, the user ID and password are passed to MySQL for authentication and are not authenticated by the server. To implement this type of authentication, start the server with security turned off. The server allows the client connection, and then stores an encrypted form of the client connection message to be used for connection to a MySQL database server at anytime during the lifetime of the server agent.


Top of page

x
Overriding the Default Connection

How to:

x

Once all MySQL connections to be accessed have been declared using the SET CONNECTION_ATTRIBUTES command, there are two ways to select a specific MySQL connection from the list of declared connections:



x
Syntax: How to Select a Connection to Access
ENGINE MYSQL SET DEFAULT_CONNECTION [connection]

where:

MYSQL

Indicates the adapter. You can omit this value if you previously issued the SET SQLENGINE command.

connection

Is the connection name specified in a previously issued SET CONNECTION_ATTRIBUTES command. If omitted, then the local database server will be set as the default. If this connection name has not been previously declared, a FOC1671 message is issued.

Note:



Example: Selecting a Connection to Access

The following SET DEFAULT_CONNECTION command selects the MySQL database server named TNSNAMEB as the default MySQL database server:

ENGINE MYSQL SET DEFAULT_CONNECTION datasource_name

Note: You must have previously issued a SET CONNECTION_ATTRIBUTES command for the datasource_name.


Top of page

x
Controlling Connection Scope

How to:

x

This topic explains how to set the scope of logical units of work using adapters. This is accomplished by the SET AUTODISCONNECT command.

A connection occurs at the first interaction with the declared database server.



x
Syntax: How to Control the Connection Scope
ENGINE MYSQL SET AUTODISCONNECT ON {FIN|COMMAND|COMMIT}

where:

MYSQL

Indicates the adapter. You can omit this value if you previously issued the SET SQLENGINE command.

FIN

Disconnects automatically only after the session has been terminated. FIN is the default value.

COMMAND

Disconnects automatically after each request. Depending on how often the event occurs, the SET AUTODISCONNECT command may result in considerable overhead. Almost all of this overhead is not related to the server. It is related to the operating system and the data source.

COMMIT

Disconnects automatically only after COMMIT or ROLLBACK is issued as a native SQL command.


iWay Software