How To Create A DSN File

How To Create A DSN File

Table of Contents

This page describes how to create a DSN file, which will allow you to modify reports through Crystal Reports.

Concept

In order to create a custom report or modify a standard report in Crystal Reports, you will need to establish a link between your report and your Control database. This link is called an ODBC (Open Database Connection) link. It allows you to communicate with your database so you can pull tables and fields directly out of your database onto your report. The ODBC is stored in a .dsn file that gets created everytime you preview a report in Control. If you open your .dsn file in Notepad, you'll see that all of the necessary information needed to connect to your database is there - server name, database name, user name, password, etc...

Cautions

As with any report changes, be sure to make a backup of your report before making changes to it. The only other caution would be to make sure you are using the correct version of Crystal Reports. If your reports are designed to work in SMS, you'll need to use Crystal Reports version 8.5 to modify reports. If your reports will be used in Control, you'll need to use Crystal Reports version XI to modify reports. Note that these versions are not backwords compatible.

Steps

1. Our first step is to create a .dsn file. This can be done one of three ways:
  • A. Use the .dsn file that Control creates everytime you open a report in Control
    • 1. Open Control and open and report in Control.
    • 2. Keep Control open and open your My Computer icon.
    • 3. In the address bar, type "%temp%" (no quotes). This will open up the local Temp folder.
    • 4. You should see a folder called "Control....". Inside of that folder, you should find a file called "DNSFile....DSN".
    • 5. Copy that file to a location that your computer with Crystal Reports installed on it can access. Feel free to rename the file.
  • B. Use the GenericDSN.DSN file that implementation can give you
    • 1. Copy the file to a location that your computer with Crystal Reports installed on it can access.
    • 2. Right click on the file. Click Edit.
    • 3. Enter your server name where it asks you.
    • 4. Save the changes.
  • C. To manually create a DSN file:
    • 1. Open NotePad
    • 2. Copy the contents of the DSN file below
    • 3. Update the following fields:
      • a. Check the SQL database name for DATABASE (usually StoreData by default).
      • b. Update your UserName in WSID.
      • c. Update the SQL Server and Instance name for SERVER.
    • 4. Save the file with the .DSN extention. (We recommend using Control.DSN or something to identify it.)
    • [ODBC]
      DRIVER=SQL Server
      UID=cyrious
      Trusted_Connection=No
      DATABASE=StoreData
      WSID=CRYSTAL19-UserName
      APP=Cyrious Control - Ver. 04.50.1108.1202 ODBC
      SERVER=CRYSTAL19\SQL2008R2

2. The next step is to use the DSN file to link to your database.
  • A. Open your report in Crystal Reports.
  • B. Click Database > Set Database Location
  • C. On the ODBC (RDO) screen, select Find File DSN and navigate to your DSN. Click Next.
  • D. Your username is cyrious and your password is Contact Cyrious Tech Support for Password and ask for the password to the cyrious user in SQL for Control.
3. You should then be able to add and remove tables and/or fields as needed.

Source

Contributor: Cyrious Software
Version: Control 3.1+

See Also