DEV Community

Cover image for How to Configure Data Sources for ODBC Connector
Nik Mal
Nik Mal

Posted on

How to Configure Data Sources for ODBC Connector

Microsoft Access databases can be connected to an external data source, such as a Microsoft SQL Server database, using the ODBC (Open Database Connectivity) protocol. Here, we are going to discuss how to configure data sources for the ODBC connector using several methods. Based on the database products and ODBC drivers that are being used, the steps in the approach may change.

What is a data source? This is a data set plus the connection information that is required to access this data source. An example of a data source is a relational database management system like SQL Server or Oracle. The connection information includes such data as the server location, database name, username, password, and other ODBC driver parameters that specify how to connect to the data source, among other things. You can get the information about the database you would like to access by contacting the DBA.

ODBC is an open database architecture in which the Access application connects to the ODBC Driver Manager, which approaches a data source through an ODBC driver (e.g. the Microsoft SQL ODBC driver). External data sources that do not have predefined drivers can be connected to via ODBC data sources.

To establish an ODBC connection with these data sources, you need to complete the following steps:

  1. Install the proper ODBC driver on the PC that has the data source.
  2. Set the data source name (DSN) to save the connection information in the Microsoft Windows registry or a DSN file by giving the connection information straight to the ODBC Driver Manager using Visual Basic code via a connection string or with the help of ODBC Data Source Administrator.

The data on a computer can be stored in two ways:
Machine Data Sources
File Data Sources

Machine Data Sources
Machine data sources are unique to every computer. They store information about their connections in the Windows Registry on a particular physical machine. The data sources can be accessed only on the computing device where they have been defined. Machine data sources can be divided into user-defined and system-defined types. User-defined data sources are only accessible by the active user and inaccessible by others. System-defined data sources are accessible and viewable by all users on the machine. In situations when greater security is sought, a machine data source can be particularly useful because it can only be accessed by logged-in users and cannot be copied to another computer by an unauthenticated user.

File Data Sources
When using file data sources, unlike machine data sources, you can store the information about the connection in an independent text file rather than the Windows registry. This gives you more freedom in how you use the data sources. It is possible to copy a file data source to any machine that has the necessary ODBC driver, ensuring that your program has steady and unerring connection information for all the systems that it can connect to. If you choose to host the file data source on one server and distribute it across a network of machines, you can do so while centrally controlling the connection data.

Additional restrictions may apply to the use of a file data source. A file data source that is stored on one computer is non-transferable and indicates the path to a machine data source. It is possible to connect to created before machine data sources using non-shareable file data sources.

To indicate connection details, you can declare a formatted connect string in a module. A connect string sends connection information straightforwardly to the ODBC Driver Manager. It simplifies your application by eliminating the need for a system administrator or even a user to create a DSN before connecting to the database, which saves time and effort.

Now, let’s see how to add an ODBC data source. Before proceeding, you must first get and install the proper ODBC driver for the data source to which you wish to connect. A helpful and effective ODBC connector for MySQL that saves your time and efforts might be very useful in this case.
Note: You must obtain administrative privileges before you can add or modify an ODBC data source.

  1. To get started, select Start, then Control Panel.
  2. Double-click Administrative Tools in the Control Panel.
  3. In the Administrative Tools dialog box, double-click Data Sources (ODBC) to open it. You can see the ODBC Data Source Administrator dialog box on your computer screen.
  4. Choose the type of data source you intend to add: User DSN, System DSN, or File DSN.
  5. Click Add.
  6. After having chosen the proper driver, select Finish or Next. To expand your possibilities, you can use a MySQL ODBC driver that fully supports common ODBC API functions and data types, enabling simple and secure remote access to MySQL data. Note: If you can’t find the driver you seek in the list, contact the database administrator, who will provide you with guidance on how to get the right one.
  7. Following the on-screen prompts, provide the connection information needed in the dialog boxes that may appear. In the ODBC dialog boxes, select Help to find out more about the specific options available to you.

If you’re searching for a full-fledged connectivity tool with expanded features for accessing MySQL, Microsoft Azure Database for MySQL, MariaDB, and other databases from ODBC-compatible reporting, analytics, business intelligence, and ETL applications, this efficient ODBC connector is a good choice.

Top comments (0)