Home > FAQ > Useful Basic Tasks when writing a script > How do I find the window which has the focus?

How to Create an ODBC Connection to a Database

Before you can connect to a database, you need to configure the data source name (DSN) identifying the database or file accessed by the ODBC driver. An ODBC driver is a component which processes ODBC requests and return data to the application. 

So first you need to make sure that you have the required ODBC driver installed. If you have Microsoft Office installed you already have the standard Microsoft ones for Microsoft Access, Excel, dBase, Paradox etc. You may also already have the driver for Microsoft SQL Server installed. If you want to connect to a third party database such as Oracle, Sybase, MySQL etc., then you may need to install the required drivers (see the help system of the thrid-party database).

Then you create a Data Source Name using the ODBC Data Source Administrator. See below the steps depending if you use a Windows 32 bits or a Windows 64 bits.

Data Source Name Creation with a Windows 64 bits

  1. Click Windows Start Button and in the Run box, type C:\windows\SysWoW64\odbcad32.exe

  2. The ODBC Data Source Administrator screen is displayed listing your already installed drivers.

  3. Let's say you want to add a DSN referring to an Access database (.mdb file). Click Add button. The Create New Data Source screen is displayed, select Microsoft Access Driver (*.mdb) and click Finish button.

  4. The ODBC Microsoft Access Setup screen is displayed, it is the screen where you gve a name to the Data Source Name and where you specify to which file this DSN refers. As an example, type WinTaskTest in Data Source Name field and click Select button. 

  5. The Select Database screen is displayed, browse for the database file that you want to access, in this example wintasktest.mdb, and click OK button.

  6. The ODBC Microsoft Access Setup screen comes back showing the relation between the DSN and the database file on your system.

  7. Click OK button. Your DSN is now created and can be accessed by WinTask Database Functions.


Data Source Name Creation with a Windows 32 bits

  1. Click Windows Start Button and select Control Panel. In Control Panel screen, select System and Security then Administrative Tools and double click Data Source (ODBC).

  2. Follow the other steps (starting at point 2) in the above paragraph Data Source Name Creation with a Windows 64 bits.

See also
Database Functions