Crystal Reports "Database logon failed"

Problem

When running a Crystal based report (ex: Num… reports; and others) an error occurs. Clicking “Details” reveals an error similar to the following.

Crystal Reports failed to logon to the database. Error Details Server Error in '/AdamsWeb' Application. Database logon failed. Description: Database logon failed. Exception Details: System.Runtime.InteropServices.COMException: Database logon failed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [COMException (0x8004100f): Database logon failed.] CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0 CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +643 [LogOnException: Database logon failed.] CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +262 CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +1508 CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +668 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) +114 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) +95 Foray.Adams.Reports.CrystalReportInstance.Run(String baseUrl) +878

Solution

There are two known issues that can cause this error.

Issue 1 - Database username

  1. With Microsoft Azure SQL the username must include the server name

  2. This can either be only the server name or the FQDN for the server

  3. Ex: username@myserver or username@myserver.mydomain.com

Issue 2 - TLS

  1. Crystal only understands TLS 1.0

  2. If the DB is configured to require TLS 1.1, 1.2, or later this error will occur.

  3. Configure the DB to allow TLS 1.0 or later

  4. For a Microsoft Azure SQL DB this is done on the server’s Firewalls and virtual networks blade

Related articles

© 2023 Foray, LLC - All Rights Reserved