cancel
Showing results for 
Search instead for 
Did you mean: 

Database logon failed when deploy CR on Windows Server 2008

Former Member
0 Kudos

I use Crystal Reports for Visual Studio 2010 Production Release with MVC 2 web aplication and SQL Server 2008 database server. When I compile/run from VS 2010 it running well, but when deploy it on Windows Server 2008, when load certain report (Not All report) face the following exception message:

Database logon failed

Stack Trace is as the following:

at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at SequisLife.Controllers.ReportController.run_report(String report_name, IDictionary`2 dic_param)

InnerException:

System.Runtime.InteropServices.COMException (0x8004100F): Database logon failed. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

run_report method is as the following:

private ActionResult run_report(string report_name, IDictionary<string, string> dic_param)

{

string ls_respon = "";

try

{

get_sqllogin();

ReportClass rptH = new ReportClass();

rptH.FileName = Server.MapPath(VirtualPathUtility.ToAbsolute(report_name));

rptH.Load();

rptH.Refresh();

Database crDataBase;

Tables crTables;

TableLogOnInfo crTableLogOnInfo;

ConnectionInfo reportConnectionInfo = new ConnectionInfo();

reportConnectionInfo.ServerName = server;

reportConnectionInfo.DatabaseName = database;

reportConnectionInfo.UserID = login_user;

reportConnectionInfo.Password = login_pass;

crDataBase = rptH.Database;

crTables = crDataBase.Tables;

foreach (Table crTable in crTables)

{

crTableLogOnInfo = crTable.LogOnInfo;

crTableLogOnInfo.ConnectionInfo = reportConnectionInfo;

crTable.ApplyLogOnInfo(crTableLogOnInfo);

}

ParameterFields lpf_parameters = rptH.ParameterFields;

if (lpf_parameters.Count > 0)

{

foreach (ParameterField lpf_param in lpf_parameters)

{

var llst_tmps = dic_param.Where(d => d.Key == lpf_param.Name);

foreach (var param in llst_tmps)

{

if (param.Key == lpf_param.Name)

{

if (lpf_param.ReportName == "")

{

rptH.SetParameterValue(lpf_param.Name, param.Value);

}

else

{

rptH.SetParameterValue(lpf_param.Name, param.Value, lpf_param.ReportName);

}

}

}

}

}

Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

return File(stream, "application/pdf");

}

catch (Exception ex)

{

ls_respon += ex.Message;

ls_respon = " - "ex.StackTrace;

ls_respon += " - " + ex.InnerException;

ls_respon += " - " + ex.Source;

ls_respon += " - " + ex.Data;

return Content(ls_respon);

}

}

Please any body hepl me...

Thank's in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

If it's only certain reports, then compare the reports:

Connection type (OLE DB, ODBC, etc.).

Is it reports with subreports only? If so, check the above and log on to the subreports.

Check other differences. parameters? Tables vs. Stored Proc, etc., etc.

- Ludek

Former Member
0 Kudos

Thanks Ludek,

I found that it was about the connectivity.

When I changed the connectivity to OLEDB the problem was solved.

Previously I used MS SQL Server 2008 Native Client

Regards,

Sugi

0 Kudos

Make sure the SQL 2008 Client tools are installed on the Server then the Native 10 driver should work.

Don

Former Member
0 Kudos

I already installed SQL 2008 Client tools on the Server

It seems that on certain condition/query, Native 10 driver didn't work. That is way only affect to certain report. Some report still run using native connection.

Sugi

Former Member
0 Kudos

Hello Ludek,

I'm trying to use Crystal Report for Visual Studio 2010 in a PC Windows XP, then I deploy a ASP.NET web site with CrystalReportsViewer in a Windows 2008 Server, where I installed Crystal Reports 2013 trial version (that I use for report development) and Visual Studio 2010 Runtime (64 bit).

When I try to open a simple report (without any DB access) I can display it in ASP.NET page, but when I try to add DB access (I tryed to configure both Oracle Server and OLEDB with oracle driver in Expert Database dialog, Crystal Reports 2013), I get a connection database error..

I tryed to use same connection code posted by Sugi Ardana.

I have to use 32 bit runtime instead 64 bit in Windows 2008 Server?

I have to made some changes in configuration?

Thank you in advance,

Guglielmo

Answers (1)

Answers (1)

0 Kudos

Hello,

If your app is complied for 64 bit then you need the 64 bit client installed and configured. If your app is running in 32 bit mode the you need the 32 bit client installed and configured.

Thank you

Don

Former Member
0 Kudos

Hi,

I am using CR with visual studio 2010 in windows 7 box 64bit box. using a ADO.net data source. And I need to export .rpt as pdf.The solution works fine in my dev box. by when i try to deploy in a windows server 2008 R2 box (64bit) it fails . Both my dev box and deplyment box uses sql server 2008 DB . Also i am using .Net framework 4.0 (not client profile)

installed the following things in deployment box:

1. CRRuntime_64bit_13_0_1.msi in

2. Also copied the CRforVS_mergemodules_13_0_1 in C:\Program Files (x86)\Common Files\Merge Modules

I get the following error in my Box:

CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName) at Tesco.Instore.PickingControl.ReportController.PrintDriverDocumentation(String driverDocumentation, Int32 vehicleTripId)] 20/10/2011 08:08:41 PCS Critical Classic .NET AppPool Error running End of Van [Logon failed.

Error in File temp_31b3196f-fd25-45c8-b657-5d9cd7c9dccb {4F74290C-D56E-4FC4-8DEF-371BB5C5B10B}.rpt:

Unable to connect: incorrect log on parameters.]

I also verified the database connection is upto date. while creating the solution

the project build is set to anyCPU.

is there anything else i have to install ?? Please help me ..I am trying this thing from last one week and have not got any proper solution till now

former_member183750
Active Contributor
0 Kudos

Set the project to 32 bit CPU.

When you set the project to Any CPU and deploying it to 64 bit OS, th eproject will be looking for 64 bit runtime, and 64 bit DB client.

If this is a 32 bit app, compile as 32 bit, make sure you have 32 bit datasource and client.

If this does not work, please create a new thread as this one is mrked as "answered".

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]