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.
Under Administrative Tools select Data Sources (ODBC). The Data Source Administrator opens.
You may also use Control Panel –-> Administrative Tools –> Data Sources (ODBC).
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.
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.
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"
On the next dialog we define the user name and the password for the database, enter whatever is appropriate for your database.
Select the default database and check the ANSI options.
Almost there, leave everything as per default and click Finish.
The summary, click on the Test Data Source button.
And voilà, click OK to close the dialog.
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.