Creating Data Link (UDL) Files in Delphi - Section 1: Adding a new ODBC Data Source
(Page 2 of 5 )

[dsn_Screenshot1.jpg]
Go to control panel|Administrative Tools and click on the Data Source (ODBC) icon. This should bring up a multi-tabbed dialog box. Click on the Add button and you are presented with a list of available drivers. Select the appropriate driver (which in my case is MS SQL Driver) and click Finish. Another dialog is displayed; enter the data source name and description which you will later use to connect to the data source.
The drop-down box lists the available database servers on the network; select the appropriate server name and click Next. The next step requires you to specify how the server should authenticate the login, OS authentication or SQL Server authentication with the credentials provided by the user. If it's the latter then you need to make sure you have entered the correct username and password. Click next, and from the drop-down box select "testdb" as the default database.
The last page contains language, encryption, regional settings and logging options which are pretty much obvious. After clicking finish you are presented with a message window listing the configuration. Click on "Test connection" to make sure that the Data Source was created successfully. If the result is affirmative you have successfully created the DSN and can now use it to connect to the database from your Delphi program.
Now let us get back to the .udl file. Double-click on it to bring up the Data Link Property dialog box if it is not already visible. Make sure the Connection tab has focus. The ODBC DSN you created should now be available in the drop-down box (click refresh if it is not available). Select the DSN, enter the user name and password and check "allow saving password." Next select the initial catalog to use from the list available in the drop-down box. Click test connection to verify that the connection was successful.
Next: Section 2: Connecting with SQL Server Drivers >>
More Delphi-Kylix Articles
More By Danish Ahmed