# Database: WinSQL

## WinSQL Description

This is a client program that allows you to enter SQL commands, which it will send to a database server or database engine on the same machine, on the LAN, or anywhere on the Internet. It will then display the results that the server sends back. It communicates with the server with the ODBC protocol. ODBC is a widely supported standard for database client-server communication.

## Downloading and Installing

Download WinSQL from www.indus-soft.com (about 0.700 MB)as the zip file winsql.zip. Install it by extracting the one file (Winsql.exe) into its final destination. I put it in C:\Program Files\indus-soft\.

## Looking for an ODBC DataSource Name (DSN) in Windows

Before starting WinSQL, there must be a data source available to it. To determine if one is already defined,

1. Select Start / Settings / Control Panel / ODBC.
2. Select the User DSN tab if it isn't already selected.
3. Look for a data source for the database you want to connect to. If you can find one, skip the next section (creating a data source), and follow the instructions for running WinSQL. If you can't find one, you can create one by following the instructions in the next section.

## Creating an ODBC DataSource Name in Windows

This describes how to create a data source for a MS Access database. You have to create this the first time for each database that you want a client to connect to.

1. Select Start / Settings / Control Panel / ODBC.
2. Click the Add button.
3. For this example we are going to choose MS Access Database, but you can choose any ODBC driver that is installed. If you use some other kind of database, you may have to install their ODBC driver and it will show up in this dialog box. Double click the MS Access Database entry to open it. You will have to fill in a couple of fields in this dialog box (ODBC Microsoft Access Setup).
4. Click the Database Select button to choose an existing .mdb (MS Access database) file. Click OK.
5. Specify a Data Source Name.
6. Give it a description too. You can specify other options, such as ID and password, but you don't have to. If you are connecting over the network, you will have to select TCP/IP and a port (1433 ?).

## Running WinSQL

- WinSQL will start with a dialog box that asks you to select the data source. Choose the one that you just defined.
- WinSQL will connect to the datasource and give you a window with three tabs: Query (where you can type your SQL statements), Result (where you can view the results), and Catalog (where you can view all the elements in the database). It's probably easiest to start with the Catalog tab to see what is available.