Skip to Content
0
Jul 17 at 08:38 AM

Crystal Reports' JDBC connecting with Postgres at .net framework

133 Views

I have a report made with Crystal Reports 2020, I connected it with local Postgres Database using JDBC. It's successful.

Now, I want to print report output with C#(.Net Framework 4.8), I tried every variant, but it wasn't successful. I have got error:"Failed to load database information.".

My server parameter is most probably wrong,I dont know maybe it's right but other parameters are wrong .I searched it ,read lots of sources but I didn't solve it. How do I change a Crystal Report's JDBC connection parameters?

My last code:

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load(@"C:\Users\AtillaAliyev\Desktop\ActuerialProject\ActuerialReports\DeathPRM.rpt");
            CrystalDecisions.Shared.ConnectionInfo myConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
            myConnectionInfo.ServerName = "Driver = {org.postgresql.Driver}; Server=jdbc:postgresql://localhost;Port=5432;";
            myConnectionInfo.DatabaseName = "ActuerialCalculationAPIDatabase";
            myConnectionInfo.UserID = "postgres";
            myConnectionInfo.Password = "admin";
            foreach (CrystalDecisions.CrystalReports.Engine.Table item in cryRpt.Database.Tables)
            {
                TableLogOnInfo t = item.LogOnInfo;
                t.ConnectionInfo = myConnectionInfo;
                item.ApplyLogOnInfo(t);
            }

            cryRpt.SetParameterValue("report_id", 1);
            cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"C:\Projects\test1.pdf");

        }
    }
}

Attachments

3rs9z.jpg (68.5 kB)