tekuhne
asked on
Crystal Reports and Azure - Stored Procedure trouble
I’m in the process of moving our Crystal Reports and reporting software from a dedicated server environment to Microsoft Azure. NOTE: I’m not a developer but trying to pass on ideas for troubleshooting to our software developers.
I’m using Crystal Reports 2016.
The trouble I’m having is with some stored procedures that the Crystal Reports template is calling.
I was able to get a print preview to work once I switched from ODBC Driver 17 back to ODBC Driver 13. ODBC drive 11 doesn’t see any of the databases on Azure. ODBC 17 worked with all tables and views, but not the stored procs. ODBC 13 works with everything.
However, we have a custom reporting service that populates the templates with data and exports them to PDF. This custom service is crashing and not finding the stored procs. I’m guessing it’s because that code uses ADO.NET connections to the db, which is having the same problem of seeing the stored procs as some of the ODBC drivers.
Error that I’m getting:
STATE: PROCESSING JOB: Job failed to print. #25868
Details: System.Runtime.InteropServ ices.COMEx ception (0x800002C5): The table 'prReleaseMarkup;1' could not be found.
Error in File xxx.rpt:
The table could not be found.
at CrystalDecisions.ReportApp Server.Con trollers.D atabaseCon trollerCla ss.SetTabl eLocation( ISCRTable CurTable, ISCRTable NewTable)
at CrystalDecisions.CrystalRe ports.Engi ne.Table.s et_Locatio n(String value)
at Com.Wolfgang.bc.CrystalAut omater.bcC rystalAuto mater.conn ectDatabas e(String DBDll, String DSNName, String DBName, String DBUserID, String DBPassword, Int32 testNumber, String& errMsgs) in C:\xxx\CrystalAutomater\Cr ystalAutom ater.cs:li ne 500
Any ideas on what to try next, besides removing the stored procedures from the report? That will probably be my last resort, but we have hundreds of reports to remove it from.
Thanks!
I’m using Crystal Reports 2016.
The trouble I’m having is with some stored procedures that the Crystal Reports template is calling.
I was able to get a print preview to work once I switched from ODBC Driver 17 back to ODBC Driver 13. ODBC drive 11 doesn’t see any of the databases on Azure. ODBC 17 worked with all tables and views, but not the stored procs. ODBC 13 works with everything.
However, we have a custom reporting service that populates the templates with data and exports them to PDF. This custom service is crashing and not finding the stored procs. I’m guessing it’s because that code uses ADO.NET connections to the db, which is having the same problem of seeing the stored procs as some of the ODBC drivers.
Error that I’m getting:
STATE: PROCESSING JOB: Job failed to print. #25868
Details: System.Runtime.InteropServ
Error in File xxx.rpt:
The table could not be found.
at CrystalDecisions.ReportApp
at CrystalDecisions.CrystalRe
at Com.Wolfgang.bc.CrystalAut
Any ideas on what to try next, besides removing the stored procedures from the report? That will probably be my last resort, but we have hundreds of reports to remove it from.
Thanks!
ASKER
Hi Arnold, The stored procedure is there. I can see it through SQL Management Studio and the report sees it when I do a print preview using the ODBC 13 drivers.
The report doesn't see it when using the data connections through our reporting service.
The report doesn't see it when using the data connections through our reporting service.
Double check, confirm the odbc connectio. Defined in the report is the one used.
Try to explore data in the report using crystal reports.
The message you posted points to a missing table.
Are there other reports that work, or none of the reports work?
Try to explore data in the report using crystal reports.
The message you posted points to a missing table.
Are there other reports that work, or none of the reports work?
ASKER
Yes, I'm sure the stored procedure is there. The message of a missing table is the error message that Crystal Reports gives because it can't see the Stored Proc.
As I tried to lay out in my original post, there seems to be only one connection type that allows Crystal to see Stored Procedures on Azure, and that's the ODBC 13. When I do a print preview using that ODBC connection, everything works fine. The report finds the stored procedures and fully generates.
Unfortunately, it seems that my custom report service isn't using that ODBC connection type. It's probably using an ADO.Net connection.
What I'd like to know is - are there any code changes or settings that we can change in our custom report service to change how it's connecting to SQL Server on Azure to allow it to see Stored procedures?
As I tried to lay out in my original post, there seems to be only one connection type that allows Crystal to see Stored Procedures on Azure, and that's the ODBC 13. When I do a print preview using that ODBC connection, everything works fine. The report finds the stored procedures and fully generates.
Unfortunately, it seems that my custom report service isn't using that ODBC connection type. It's probably using an ADO.Net connection.
What I'd like to know is - are there any code changes or settings that we can change in our custom report service to change how it's connecting to SQL Server on Azure to allow it to see Stored procedures?
unable to see a table and unable to run a stored procedure
can you confirm that the user/credentials under which crytal reports accesses the DB has rights to run the SP/access the tables.?
can you confirm that the user/credentials under which crytal reports accesses the DB has rights to run the SP/access the tables.?
ASKER
Yes, I can confirm that they do have access. Next thing we are going to try is to change our report application to have it use the ODBC connection that works instead of ado.net
ASKER
Changing code to ODBC connection is still causing issues. From my developer:
I pulled the relevant code into a class that can be sent for review. The issue we are seeing is an error that occurs when we set the log on info for a subreport when the table references a stored procedure instead of a view. I added a comment above that line in the code, and tried to add as much additional information as I thought may be helpful. Of course I may have missed something, so let me know if I can add more detail.
using System;
using CrystalDecisions.Shared; //CrystalDecisions.Shared. dll - Runtime Version v2.0.50727
using CrystalDecisions.CrystalRe ports.Engi ne; //CrystalDecisions.Crystal Reports.En gine.dll - Runtime Version v2.0.50727
namespace CrystalAutomator
{
class TestCode
{
protected bool ConnectDatabase(ReportDocu ment report, string dbDll, string dsnName, string dbName, string dbUserId, string dbPassword, out string errorMessages)
{
errorMessages = "";
//Assert assumptions
if (null == report)
{
errorMessages = "Report is not initialized.";
}
else
{
try
{
TableLogOnInfo logonInfo;
// Set the logon information for each table.
foreach (Table table in report.Database.Tables)
{
// Get the TableLogOnInfo object.
logonInfo = table.LogOnInfo;
// Set the server or ODBC data source name, database name, user ID, and password.
logonInfo.ConnectionInfo.S erverName = dsnName;
logonInfo.ConnectionInfo.D atabaseNam e = dbName;
logonInfo.ConnectionInfo.U serID = dbUserId;
logonInfo.ConnectionInfo.P assword = dbPassword;
// Apply the connection information to the table.
table.ApplyLogOnInfo(logon Info);
table.Location = table.Location;
}
// Now set logon information for each of the sub reports
foreach (Section crSection in report.ReportDefinition.Se ctions)
{
foreach (ReportObject crObject in crSection.ReportObjects)
{
if (crObject.Kind == ReportObjectKind.Subreport Object)
{
var crSubReport = (SubreportObject)crObject;
var crSubRepDoc = crSubReport.OpenSubreport( crSubRepor t.Subrepor tName);
// Set the logon information for each table.
foreach (Table table in crSubRepDoc.Database.Table s)
{
// Get the TableLogOnInfo object.
logonInfo = table.LogOnInfo;
// Set the server or ODBC data source name, database name, user ID, and password.
logonInfo.ConnectionInfo.S erverName = dsnName;
logonInfo.ConnectionInfo.D atabaseNam e = dbName;
logonInfo.ConnectionInfo.U serID = dbUserId;
logonInfo.ConnectionInfo.P assword = dbPassword;
// Apply the connection information to the table.
//This next line is where we see an error when the table references a stored procedure instead of a view
table.ApplyLogOnInfo(logon Info);
table.Location = table.Location;
}
}
}
}
return true;
}
catch (Exception ex)
{
errorMessages = "Could not connect to the database. \n\nDetails: " + ex;
}
}
return false;
}
}
}
I pulled the relevant code into a class that can be sent for review. The issue we are seeing is an error that occurs when we set the log on info for a subreport when the table references a stored procedure instead of a view. I added a comment above that line in the code, and tried to add as much additional information as I thought may be helpful. Of course I may have missed something, so let me know if I can add more detail.
using System;
using CrystalDecisions.Shared; //CrystalDecisions.Shared.
using CrystalDecisions.CrystalRe
namespace CrystalAutomator
{
class TestCode
{
protected bool ConnectDatabase(ReportDocu
{
errorMessages = "";
//Assert assumptions
if (null == report)
{
errorMessages = "Report is not initialized.";
}
else
{
try
{
TableLogOnInfo logonInfo;
// Set the logon information for each table.
foreach (Table table in report.Database.Tables)
{
// Get the TableLogOnInfo object.
logonInfo = table.LogOnInfo;
// Set the server or ODBC data source name, database name, user ID, and password.
logonInfo.ConnectionInfo.S
logonInfo.ConnectionInfo.D
logonInfo.ConnectionInfo.U
logonInfo.ConnectionInfo.P
// Apply the connection information to the table.
table.ApplyLogOnInfo(logon
table.Location = table.Location;
}
// Now set logon information for each of the sub reports
foreach (Section crSection in report.ReportDefinition.Se
{
foreach (ReportObject crObject in crSection.ReportObjects)
{
if (crObject.Kind == ReportObjectKind.Subreport
{
var crSubReport = (SubreportObject)crObject;
var crSubRepDoc = crSubReport.OpenSubreport(
// Set the logon information for each table.
foreach (Table table in crSubRepDoc.Database.Table
{
// Get the TableLogOnInfo object.
logonInfo = table.LogOnInfo;
// Set the server or ODBC data source name, database name, user ID, and password.
logonInfo.ConnectionInfo.S
logonInfo.ConnectionInfo.D
logonInfo.ConnectionInfo.U
logonInfo.ConnectionInfo.P
// Apply the connection information to the table.
//This next line is where we see an error when the table references a stored procedure instead of a view
table.ApplyLogOnInfo(logon
table.Location = table.Location;
}
}
}
}
return true;
}
catch (Exception ex)
{
errorMessages = "Could not connect to the database. \n\nDetails: " + ex;
}
}
return false;
}
}
}
ASKER
Moved from Azure SQL as a service to an Azure VM with SQL on it. That fixed the issue.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
The error you have is the table is does not exist.
The table 'prReleaseMarkup;1' could not be found.
Look on the current environment the definition of this table, view....