cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to Retrieve Information from the Database

Former Member
0 Kudos

Background: I've got a C# application which utilizes the Crystal Report Engine for .NET Framework 4.0 (Code below). The Crystal Reports it connects to access Oracle directly, but my application feeds them the connection string they are to use. There are 60+ reports that my application cycles through.

As I understand it there are two pieces to that, one being the Crystal Report must be set to the Data Source using the same account details as the connection string, the other being the connection string passed in.

When the Crystal Report and Application use the Schema Owner as the connection string the application works fine. It cycles through all of the reports, and prints them out.

When I use a different user account (which is limited to only what this application needs) it fails on the second report. Not the first report. The first report works just fine, and the second report gets the below error: Message: Failed to retrieve data from the database. Details:  [Database Vendor Code: 942 ] Failed to retrieve data from the database. Error in File [Crystal Report Name]

What I find strange is that the first and second report are identical in terms of which Oracle Objects they utilize.

Does Crystal Report Engine require any special permissions beyond Select? Is there potentially something else amiss?


//CR is an Instance of ReportDocument class, DBCnnctn is a class that pulls Connection info from an XML file

cr.Load(sReportPath + ReportName);

//Set the connection Info to be what is stored in the global variables and apply them to all the tables in the

//report, and all tables in each sub report

crConnectionInfo.ServerName = DBCnnctn.sDS;

crConnectionInfo.DatabaseName = "";

crConnectionInfo.UserID = DBCnnctn.sUID;

crConnectionInfo.Password = DBCnnctn.sPW;

cr.RecordSelectionFormula = rSelFormula + CycleNum;

cr.SummaryInfo.ReportTitle = CycleNum + " " + ReportName;

SetDBLogonForReport(crConnectionInfo, cr);

SetDBLogonForSubReport(crConnectionInfo, cr);

rpt.ReportSource = cr;

rpt.Refresh();

               

cr.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;

cr.ExportToDisk(ExportFormatType.PortableDocFormat, ReportName + CycleNum + ".pdf");

cr.Close();

If there are any additional details that I can provide to help, let me know.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Thomas

The eror is being passed from the db client through the report engine unmodified. So searching for the error in the Oracle documentation will be a good idea. Doing a bit of googling on the error it appears to resolve to either table does not exist or table cannot be accessed. If it is an access issue, you will have to try and figure out why. Also, see the following:

1767703 - Error: [Database Vendor Code: 942 ] Failed to retrieve data from the database

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you Ludek and Don for responding to me.

I've read a bunch of your other posts on other Crystal Reports topics, and I'm thankful for all the help I've received through them as well.

For this particular one, the Crystal Report was designed using an ODBC connection, and my application was designed using an exceedingly similarly named ODBC connection which was not in fact the same one. The two different ODBC Connections clashed and caused it to fail. The odd part is that when using the Schema Owner's username it worked with misaligned ODBC connection, but on other accounts (with similar privileges) it didn't.

former_member183750
Active Contributor
0 Kudos

Hi Thomas

Many thanks for sharing the solution with us

Have a great day,

- Ludek

0 Kudos

You need to update the log on info using ReplaceConnection. Search for this and you'll find sample code. But you may simply be able to rebuild the connection to qualify the change.

Don