SAP Knowledge Base Article - Public

3034887 - Error: 'Cannot find DSN in connection string', when creating a new report using an ODBC connection string in Crystal Reports

Symptom

  • Unable to connect to the database.
  • When creating a new report using a connection string, it fails.
  • In Crystal Reports, when attempting to connect to a data souce via ODBC, using a connection string, it fails with the error:
      
      "Logon failed.
       Details: Cannot find DSN in connection string"
       

      DSN Error.png

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020 

Reproducing the Issue

  1. In Crystal Reports, create a new report.
  2. In the "Database Expert", under "Available Data Sources", expand "Create New Connection"
  3. Double click on "ODBC (RDO)"
  4. In the ODBC Data Source Selection screen, select the option: "Enter Connection String"
  5. Enter the Connection String: Data Source=servername
  6. Click "Next"
  7. In the Connection Information screen, enter the database server name, user, and password, and click "Finish"
  8. It then generates the error: "Cannot find DSN in connection string"  

Cause

  • A Connection String is a way to create an ODBC connection to a data source without defining an ODBC DSN in the Microsoft Data Source Administrator.
  • The connection string requires the correct information, like the ODBC driver name to use, and a small mistake in the connection string will generate an error.
  • The error indicate the connection string is missing the ODBC Driver Name.

Resolution

  • Add the ODBC Driver name in the connection string, like: Driver={<ODBC Driver Name>} 
      
    1. In Crystal Reports, create a new report.
        
    2. In the "Database Expert", under "Available Data Sources", expand "Create New Connection"
        
    3. Double click on "ODBC (RDO)"
         
    4. In the ODBC Data Source Selection screen, select the option: "Enter Connection String"
         
    5. Enter the Connection String to the database that includes the ODBC Driver Name, like: Driver={<ODBC Driver Name>} 
         
      For example: To connect to MS SQL Server 2016, using the MS SQL Server Native Client 11, the connection string will be like:

         Driver={SQL Server Native Client 11.0};Server=<Your Database Server>;Database=<Your Database Name>;Uid=<User Name>;Pwd=<Password>;
         
      IMPORTANT NOTE: For details on the actual ODBC Driver Name for your specific database and ODBC Driver, consult your database provider, or your Database Administrator. 

            
    6. Click "Next"
        
    7. In the Connection Information screen, enter the database server name, user, and password, and click "Finish"
          
    8. It will then connect to the database, and list the Tables, Views, and Stored Procedures.

Keywords

CR, ODBC DSN , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020