We are porting currently our c++ application from Win 32 to Win 64 bit and want to use the new runtime to generate reports.
Runtime: CRRuntime_64bit_13_0_3.msi
The reports are based on a sql query command on ODBC database connection (MS SQL or Oracle) .
Our application replaces by API call the stored ODBC database with production database during execution/exporting of the reports.
We always got error as follows when executed a report at 64bit platform:
System Exception Handler: System.Runtime.InteropServices.COMException (0x800002CD): Failed to load database information.
Error in File EventDensity {4B302108-644E-4E2D-9EFA-3418FB4FAFA9}.rpt:
Failed to load database information.
at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.SetTableLocation(ISCRTable CurTable, ISCRTabl
e NewTable)
at CrystalDecisions.CrystalReports.Engine.Table.set_Location(String value)
at ReportGen.exportReport()
Destruct ReportGen
CmdCrystalReport FncFreeFunctionData
But if we compile our application as 32bit and use CRRuntime_32bit_13_0_3, report is generated correctly.
Any Idea whats wrong?
Here is a part of or source code that we use to set the runtime database connection and try to exprt the report:
BOOL exportReport()
{
try
{
//Setup the connection information structure to be used
//to log onto the datasource for the report.
crConnectionInfo = new ConnectionInfo ();
crConnectionInfo->ServerName = pconf->getConnectDSN(); //physical server name or odbc DSN
ProviewDBConnection* pDBConn = pconf->getProviewDBConnection();
crConnectionInfo->DatabaseName = pDBConn->getDatabaseName(); // use the default database
crConnectionInfo->UserID = pconf->getConnectUID();
crConnectionInfo->Password = pconf->getConnectPWD();
//Get the table information from the report
crDatabase = crReportDocument->Database;
crTables = crDatabase->Tables;
//Loop through all tables in the report and apply the connection
//information for each table.
for (int i = 0; i < crTables->Count; i++)
{
crTable = crTables->Item [i];
crTableLogOnInfo = crTable->LogOnInfo;
crTableLogOnInfo->ConnectionInfo = crConnectionInfo;
crTable->ApplyLogOnInfo(crTableLogOnInfo);
crTable->Location = crTableLogOnInfo->TableName->Substring(crTableLogOnInfo->TableName->LastIndexOf(".") + 1);
//crTable->Location = crTableLogOnInfo->TableName->ToUpper();
}
exportPath = exportPath->Insert(exportPath->Length ,S".");
exportPath = exportPath->Insert(exportPath->Length ,exportFileSuffix);
Console::Write("Exporting to ");
Console::Write(exportPath);
Console::WriteLine();
crReportDocument->ExportToDisk(exportFormat, exportPath);
}
catch(Exception* e)
{
Console::WriteLine(S"System Exception Handler: {0}", e);
TrcPrintfEx(PV_TRC_UTI, TRC_LVL_ERR,
"ReportGen::export() System exception:\n"
"Message:\n%s\nStacktrace:\n%s",
e->Message,e->StackTrace);
errorMessage = "Error:\n";
errorMessage = errorMessage->Insert(errorMessage->Length, e->Message);
String* newLine = "\nStackTrace:\n";
return FALSE;
}
return TRUE;
}