Reverse Engineer a DB [2] – ODBC setup

Database tools and applications frequently use ODBC for connection to databases. In the previous post I have described a database that we will play with. The database named CodeDB is located on a server named DAMIR5, running MS SQL Server 2005. This article provides a step-by-step procedure for creating an ODBC connection to the database.

Note: this setup is done on a "remote PC" (not the server) — the same PC that will be used to test all previously mentioned database tools.

Step 1

Under Administrative Tools select Data Sources (ODBC). The Data Source Administrator opens.
You may also use  Control Panel –-> Administrative Tools –> Data Sources (ODBC).

Step 2

The System DSN tab lists data sources available to all users on the machine, including services. This is where you would usually want to add a new source. If you want to create a data source for a current user only, use the User DSN tab. Click the Add button to create a new data source.

Step 3

Create New Data Source dialog opens. This dialog has a list of drivers for different databases, for MS SQL server 2005 use SQL Native Client. Select the driver and click Finish.

Step 4

A new dialog, for configuring the SQL Native Client opens.

  • Enter a name for the data source — I used CodeDB
  • Something for description
  • Server name or an IP address, for local database use "localhost"

Step 5

On the next dialog we define the user name and the password for the database, enter whatever is appropriate for your database.

Step 6

Select the default database and check the ANSI options.

Step 7

Almost there, leave everything as per default and click Finish.

Step 8

The summary, click on the Test Data Source button.

Step 9

And voilà, click OK to close the dialog.

Step 10

We are back at the beginning, this time the new CodeDB data source is listed under System Data Sources. Click OK to finish and exit the dialog. From this point on, this database connection is available to any application which can use an ODBC data source.