Object Data Source - PostgreSQL - Npgsql

0 Answers 249 Views
General Discussions
Raniel
Top achievements
Rank 1
Iron
Iron
Raniel asked on 23 Nov 2022, 09:05 AM

Hi, sorry for the lack of experience in object data source, my question is I am making a class to retrieve the data from postgresql db and I am using npgsql. After creating the dll, I put it in the bin folder of my TRS as what in the tutorial stated and added it in the AssemblyReferences. Do I also need to add the dll of Npgsql because when I did that, it gives me the following error

""

Or how do you retrieve the data from postgresql as object data source?

Dimitar
Telerik team
commented on 28 Nov 2022, 09:54 AM

If you have installed the Npgsql driver, you wouldn't need to reference the driver assemblies, please visit the How to Configure Postgres with Npgsql? - Telerik Reporting article for more details on this.

Regarding the error itself, Telerik Report Server is an MVC web application targeting.NET Framework version that does not fully support .NET Standard 2.0. Please try to apply the workaround from the asp.net - You must add a reference to assembly 'netstandard, Version=2.0.0.0 - Stack Overflow thread to resolve this limitation.

The Web.config file of the Report Server can be found at the following path:

C:\Program Files (x86)\Progress\Telerik Report Server\Telerik.ReportServer.Web

Trudy
Top achievements
Rank 1
commented on 13 May 2025, 04:23 PM

the Link How to Configure Postgres with Npgsql? - Telerik Reporting supplied is for Report Designer. We need instructions on how to get it installed in Report Server. All articles only mention Report Designer.
Trudy
Top achievements
Rank 1
commented on 13 May 2025, 04:46 PM

you can add the necessary DbProviderFactories entry to the web.config in C:\Program Files (x86)\Progress\Telerik Report Server\Telerik.ReportServer.Web, but that just gets the "name" text to show up in Report Server in the data provider drop down list.  Using it is a whole other issue. When you attempt to use the new Npqsql data provider after modifyting web.config you get "Connection failed. Failed to find or load the registered .Net Framework Data Provider".  and dropping the Npgsql.dll in the C:\Program Files (x86)\Progress\Telerik Report Server\Telerik.ReportServer.Web\bin renders Report Server inoperable (Excepts on the page) with 
FileLoadException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Dimitar
Telerik team
commented on 16 May 2025, 11:02 AM

Hello Trudy,

If I understand correclty, you are attempting to use the Npgsql data provider in the Telerik Report Server product, is that correct?

In this case, I highly recommend using the MSI installation approach - MSI Installation - Npgsql 3.2.7, as the installer will automatically install and configure this data provider for your system. This will allow for the Report Server to also load and use it without needing to edit configuration files or copying and pasting assemblies to various folders.

The downside of the installation approach is that it offers a bit older version as the newer versions are not available for installation through MSIs. If this is a problem for you, and you would prefer to use a newer version, you can instead apply the instructions from the .NET Framework Manual Configuration section.

However, you would need to slighly adjust steps 4 and 6 from the above seciton for the Report Server Manager and for the Service Agent:

Report Server Manager

  • On step 4, you would need to paste the Npgsql assemblies in the C:\Program Files (x86)\Progress\Telerik Report Server\Telerik.ReportServer.Web\bin directory
  • On step 6, you would need to edit the web.config file from the C:\Program Files (x86)\Progress\Telerik Report Server\Telerik.ReportServer.Web directory with the necessary binding redirects.

Service Agent

  • On step 4, you would need to paste the Npgsql assemblies in the C:\Program Files (x86)\Progress\Telerik Report Server\Services directory
  • On step 6, you would need to edit the Telerik.ReportServer.ServiceAgent.exe.config file from the C:\Program Files (x86)\Progress\Telerik Report Server\Services directory with the necessary binding redirects.

 

The Report Server Manager setup is necessary so that the Npgsql provider can be loaded when the reports are rendered in a report viewer/designer while the Service Agent setup is for the cases where the reports are rendered in scheduled tasks, data alerts, etc.

This approach is a lot harder to implement since you need to verify that each assembly related to Npgsql is present in both directories, with the correct version, and that the configuration file are correctly edited with the necessary binding redirects.

For that reason, I would like to again recommend using the MSI installation approach. Note that if you use this approach, you must remove any edits that you have made to the config file regarding the Npgsql data provider, such as the DbProviderFactories entry mentioned in the last reply.

I hope that the provided information and suggestions will help install the Npgsql provider for the Report Server. In case you need further assistance, please let me know which approach you decided to use and send me detailed logs with the errors - Troubleshoot Report Server Manager - Telerik Report Server.

If you chose to use the approach with the manual configuration, I may also need to look at the edited config file to verify that all necessary settings are present.

 

 

Trudy
Top achievements
Rank 1
commented on 16 May 2025, 11:48 AM

Hi Dimitar,

Support has replied that my Npgsql.dll that I copied to the Report Server bin directory was for .NET core and not .NET Framework so that was why it wouldn't work.  I will try your method later on, but have my setup working now by using my own REST API to serve up the reports to my angular client UI using the Telerik Report Viewer.

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Raniel
Top achievements
Rank 1
Iron
Iron
Share this question
or