cancel
Showing results for 
Search instead for 
Did you mean: 

Export() results in 'Database logon failed' on Windows Server 2008 R2

Former Member
0 Kudos

When I run my .Net Framework 4.0 web application in Visual Studio 2013 on Windows 7 it runs fine.

But when it's deployed to Windows Server 2008 R2 and I try to export my Crystal Report to I get the error 'Database logon failed'.

The database is a SQL Server 2008 R2 and the connection is made through OLEDB (ADO).

I made sure the SQL Native Client 10 was installed and that the credentials were set using: crpt.SetDatabaseLogon("user", "password", "server", "database")

As I mentioned before it works fine on my Windows 7 machine running the development environment, but fails when deploying to Windows Server 2008 R2. I even tried deploying it to Windows Server 2012, but that didn't work either.

Does anyone have a clue? Any suggestions would be greatly appreciated.

Server Error in '/Dtt' Application.

--------------------------------------------------------------------------------

Database logon failed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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) +419

[LogOnException: Database logon failed.]

   CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +334

   CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +952

   CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +657

   CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext) +208

   CrystalDecisions.CrystalReports.Engine.FormatEngine.Export() +68

   CrystalDecisions.CrystalReports.Engine.ReportDocument.Export() +64

   DttFd.Web.PwoView.ExportToPdf(ReportDocument oRpt) +379

   DttFd.Web.PwoView.Page_Load(Object sender, EventArgs e) +10943

   System.Web.UI.Control.OnLoad(EventArgs e) +91

   System.Web.UI.Control.LoadRecursive() +74

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1025

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Edmar

This is typically due to an incorrect database client. Ensure that the following is true:

For OLE DB use:

MS SQL 2005 - OLE DB Provider

MS SQL 2008 - SQL Native 10

MS SQL 2012 - SQL Native 11

MS SQL 2013 - SQL Native 11

For ODBC use:

MS SQL 2005 - SQL Native

MS SQL 2008 - SQL Native 10

MS SQL 2012 - SQL Native 11

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

  Follow me on Twitter

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ludek,

I found out I had both SQL Server Native Clients 10 and 11 installed on my development machine. Without knowing it I was deploying the Crystal Reports set to SQLNCLI11.DLL (SQL Server Native Clients 11), but the server only contained Native Client 10.

I’ve set the datasource connections in all my Crystal Reports to SQLNCLI10.DLL (SQL Server Native Clients 10) and it works like a charm.

Thank you for your help.

Kind regards,

Edmar

former_member183750
Active Contributor
0 Kudos

Beautiful how all of a sudden it all makes sense

Happy coding,

- Ludek