cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports' JDBC connecting with Postgres at .net framework

0 Kudos

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");

        }
    }
}
DellSC
Active Contributor
0 Kudos

Is there also a database error code in the error message you receive? If so, what is it?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Open the report in CR Designer, make the connection and then expand the connection properties in Set Location...

You'll see the values required.

Likely cause is the Connection name is wrapped in { }, remove them in your Server Name:

{org.postgresql.Driver}
should be
org.postgresql.Driver

Answers (0)