Batch File To Create Odbc Connection 8,0/10 6819 reviews
-->

The connection information for a file data source is stored in a .dsn file. As a result, the connection string can be used repeatedly by a single user or shared among several users if they have the appropriate driver installed. The file contains a driver name (or another data source name in the case of an unshareable file data source) and optionally, a connection string that can be used by SQLDriverConnect. The Driver Manager builds the connection string for the call to SQLDriverConnect from the keywords in the .dsn file.

I want to automate this By creating a Batch file so i can purplish it through our DC to change the new ODBC Connection to new Setting How can.

A file data source allows an application to specify connection options without having to build a connection string for use with SQLDriverConnect. The file data source usually is created by specifying the SAVEFILE keyword, which causes the Driver Manager to save the output connection string created by a call to SQLDriverConnect to the .dsn file. That connection string can be used repeatedly by calling SQLDriverConnect with the FILEDSN keyword. This streamlines the connection process and provides a persistent source of the connection string.

File data sources also can be created by calling SQLCreateDataSource in the installer DLL. Information can be written into the .dsn file by calling SQLWriteFileDSN, and read from the .dsn file by calling SQLReadFileDSN; both of these functions are also in the installer DLL. For information about the installer DLL, see Configuring Data Sources.

The keywords used for connection information are in the [ODBC] section of a .dsn file. The minimum information that a shareable .dsn file would have in the [ODBC] section is the DRIVER keyword:

You buy a Super Coolscan 4000 or 5000, or an Epson V750. Silverfast se plus 8 rapidshare software download.

The shareable .dsn file usually contains a connection string, as follows:

When the file data source is unshareable, the .dsn file contains only a DSN keyword. When the Driver Manager is sent the information in an unshareable file data source, it connects as necessary to the data source indicated by the DSN keyword. An unshareable .dsn file would contain the following keyword:

The connection string used for a file data source is the union of the keywords specified in the .dsn file and the keywords specified in the connection string in the call to SQLDriverConnect. If any of the keywords in the .dsn file conflict with keywords in the connection string, the Driver Manager decides which keyword value should be used. For more information, see SQLDriverConnect.

See Also

Any program that uses Open Database Connectivity (ODBC) to connect to a remote database needs a way to identify the type of database and the computer to which it is connecting. This is accomplished through the use of an ODBC data source, which associates a name with database connection information.

Following are instructions for setting up an ODBC data source to connect to your MySQL database on the Research Database Complex ( RDC) at Indiana University.

Download and install the MySQL Connector/ODBC driver

To configure an ODBC data source for MySQL, you must have the MySQL Connector/ODBC driver installed on your workstation. The MySQL Connector/ODBC driver allows ODBC applications to communicate with MySQL servers.

Following are instructions for downloading and installing the MySQL Connector/ODBC driver (to install the MySQL connector, you must be logged into your workstation as an administrator):

  1. Go to Oracle's DownloadConnector/ODBC page, and under 'Generally Available (GA) Releases', make sure Microsoft Windows is the platform selected.
  2. From the list of downloads, find the installer file (MSI or ZIP) you prefer for your version of Windows (32- or 64-bit), and then, next to the preferred installer type, click Download.
    The MSI files are stand-alone installers that launch setup wizards to step you through the installation process. To use one of the ZIP files, you must extract its contents, and then launch the included batch file (Install.bat) from your workstation's command prompt. In either case, the same software is installed.
  3. On the 'Begin Your Download' page:
    • To start the download immediately, click No thanks, just start my download.
    • To log in with an existing Oracle Web account before starting the download, click Login using my Oracle Web account.
    • To create an Oracle Web account before starting the download, click Sign up for an Oracle Web account.
  4. Locate and double-click the file you downloaded. If your system asks whether you want to install the program, click Yes.
  5. The MySQL Connector/ODBC Setup Wizard will launch; to begin the installation process, click Next
  6. Read and accept the License Agreement, and then click Next.
  7. Choose the installation type, and then click Next.
    Oracle recommends choosing either the Typical or Complete installation option. The Typical option provides the standard files needed to connect to a MySQL database using ODBC. The Complete option installs all the available files, including debug and utility components.
  8. On the 'Ready to Install' page, click Install.
  9. If your system asks whether you want to install the program, click Yes. (If you are not already logged in as an administrator on your workstation, you will be prompted to log in with a local administrator account.)
  10. When the files are copied to their final locations, the installation is complete; to exit the installer, click Finish.

Configure and locate an ODBC data source

To follow these instructions, you will need information contained in your RDC MySQL database welcome letter (in email). If you do not have your welcome letter, email the RDC Administration group for help.

To create an ODBC data source for your MySQL database on the RDC:

  1. On your workstation, access the Windows ControlPanel (if you need help, see Get around in Windows).
  2. Select Administrative Tools, and then DataSources (ODBC).
  3. In the 'ODBC Data Source Administrator' window, select the System DSN tab, and then click Add.
  4. The 'Create Data Source' window will list two MySQL ODBC drivers (one for ANSI and one for Unicode); select the Unicode driver unless you know you need the ANSI driver, and then click Finish. (The Unicode driver handles data from any character set and, accordingto the MySQL documentation, is recommended for most users.)
  5. In the 'MySQL Connector/ODBC' dialog box, next to 'Data Source Name', enter a name for this server connection (for example, RDC-MySQL).
  6. Optionally, enter a description of the source.
  7. Make sure TCP/IP Server is selected.
  8. Enter the hostname of the RDC host: sasrdsmp01.uits.iu.edu.
  9. For 'Port', enter the TCP/IP port: 3306.
  10. Next to 'User' and 'Password', enter the MySQL username and password.
  11. From the Database drop-down list, select the database you want to access.
  12. To confirm the connection, click Test. If the connection is valid, click OK.
  13. The ODBC data source you added will now appear in your System DSN list. To finish your ODBC configuration, click OK.

Get help

Batch file to create odbc connection download

For help with MySQL Connector/ODBC Driver, see the MySQL Connector/ODBC Developer Guide.

If you need help connecting to your MySQL database on the RDC, contact the RDC Administration team.

For information about RDC database accounts, see the Databases section of About the Research Database Complex (RDC) at Indiana University.

UITS does not support MySQL Connector/ODBC Driver beyond providing installation instructions and helping you connect to your database.