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"
Environment
- SAP Crystal Reports 2013
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
Reproducing the Issue
- In Crystal Reports, create a new report.
- In the "Database Expert", under "Available Data Sources", expand "Create New Connection"
- Double click on "ODBC (RDO)"
- In the ODBC Data Source Selection screen, select the option: "Enter Connection String"
- Enter the Connection String: Data Source=servername
- Click "Next"
- In the Connection Information screen, enter the database server name, user, and password, and click "Finish"
- 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>}
- In Crystal Reports, create a new report.
- In the "Database Expert", under "Available Data Sources", expand "Create New Connection"
- Double click on "ODBC (RDO)"
- In the ODBC Data Source Selection screen, select the option: "Enter Connection String"
- 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.
- Click "Next"
- In the Connection Information screen, enter the database server name, user, and password, and click "Finish"
- 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