rainforestnet / CrystalReportsNinja

A small Windows Console App that loads external Crystal Reports file, takes parameter inputs and export to various format or even print to printer
http://www.rainforestnet.com
92 stars 77 forks source link

I can't make untrusted ODBC System DSN work #36

Open IvanIdea opened 5 years ago

IvanIdea commented 5 years ago

When I use a trusted DSN, no problem - it works beautifully. But when I use the -U & -P parameters to pass login credentials I get errors. Here's my command line:

C:\Users\Administrator\Desktop\CrystalReportsNinja -F C:\WebProjects\MIF45_AR\Reports\RptFiles\SetupReports\PlantSurchargeListing.rpt -O C:\ItWorks.pdf -E pdf -S NASPlant2 -U sa -P access -D LL_PLANT

Here's the output: Report loaded successfully Database Login done Exception: Logon failed. Details: [Database Vendor Code: 18456 ] Database Connector Error: ' [Database Vendor Code: 18456 ]' Logon failed. Failed to export the report. Error in File PlantSurchargeListing 49164664{240EE7F6-10AC-416D-B5FB-0ECFF5BD651D}.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ] Inner Exception: System.Runtime.InteropServices.COMException (0x8004100F): Logon failed. Details: [Database Vendor Code: 18456 ] Database Connector Error: ' [Database Vendor Code: 18456 ]' Logon failed. Failed to export the report. Error in File PlantSurchargeListing 49164664{240EE7F6-10AC-416D-B5FB-0ECFF5BD651D}.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ] at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) NULL

bushy555 commented 5 years ago

I was getting the same error and the same issue. ...humor me by doing the following -- if you can and if you have access to the crystal reports software product:

open/edit the crystal report, remove the 'save with data' field under "FILE" tabe, re-save the crystal, and re-run. Does it now product the crystal report?, or is it still giving the same error?

IvanIdea commented 5 years ago

bushy555

That did the trick. Thank you for the tip!

bushy555 commented 5 years ago

...unfortunately however , doing this does cause an issue with the automation of refreshing /grabbing updated data.

mhertzfeld commented 5 years ago

What type of database are you trying to connect to?

sunk818 commented 5 years ago

@mhertzfeld probably SQL Server:

https://channel9.msdn.com/Blogs/raw-tech/How-To-Fix-Login-Failed-for-User-Microsoft-SQL-Server-Error-18456-Step-By-Step

The generic message "Login Failed for User (Microsoft SQL Server, Error: 18456)" means you entered invalid credentials when logging into SQL Server.

@IvanIdea I'm curious what the user name and password is pointing to. Is it a Windows domain account or a local SQL server? You should try various account creation methods and see which one works for you.

mhertzfeld commented 5 years ago

@sunk818 good catch.

@IvanIdea For your trusted DNS, are you using domain authentication or SQL Server authentication? I am not sure passing domain creds through ninja to SQL server will work. You could use the integrated security option on the connection within the report itself and not pass any creds. That's what I typically do.