Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET connector for PostgreSQL

Tags:

postgresql

Last time I used Npgsql, i.e., version 1.0, it worked very slow. Is there any other alternative to Npgsql?

like image 622
RKh Avatar asked Jun 24 '10 17:06

RKh


People also ask

How do I connect to .NET Postgres?

In order to access the PostgreSQL database system from Microsoft.NET, we're going to use the NpgSQL2 driver for ADO.NET which can be downloaded from http://npgsql.projects.postgresql.org/. When you unzip the npgsql archive, you can find the driver in the Npgsql. dll library inside the bin directory.

Does C# work with PostgreSQL?

About. Npgsql is an open source ADO.NET Data Provider for PostgreSQL, it allows programs written in C#, Visual Basic, F# to access the PostgreSQL database server. It is implemented in 100% C# code, is free and is open source.

What is Npgsqlconnection?

What is Npgsql? Npgsql is the open source . NET data provider for PostgreSQL. It allows you to connect and interact with PostgreSQL server using . NET.


4 Answers

Version 1.0 is three years old. Try to use the newest one.

like image 70
yojimbo87 Avatar answered Oct 22 '22 15:10

yojimbo87


Npgsql is an excellent connector. Just upgrade to the new one. Make sure you take a look at the documentation it is really good. That will solve the speed issue.

You asked about an alternative, so I also have to recommend an another good connector: dotConnect for PostgreSQL. It is made by Devart. There is a simple free one as well as a fully robust pay connector. The pay one has Linq and entity framework support. http://www.devart.com/dotconnect/postgresql/

like image 45
Stradas Avatar answered Oct 22 '22 13:10

Stradas


I have experience with the .NET MySQL connector. What you are describing seems to be a DNS issue. If you are using a URL in your connection string and are able to change it to an IP address, try that and see if your delay goes away.

like image 21
miro99 Avatar answered Oct 22 '22 13:10

miro99


npgsql is still the choice for .NET when connecting to PostgreSQL.

Since version 1.0, the connector has improved drastically, check out this presentation from Shay Rojansky; it is not the latest, still the boost was already quite impressive in 2018/11.

If you are upgrading from an old version, read the release notes of the latest carefully, you might break functionality in your code.

Also, I strongly recommend considering optimizing PostgreSQL as well. I work with it daily in a distributed enterprise environment, with massive workloads; it can be tuned and tweaked with a dramatic impact on the overall performance.

like image 24
hyperd Avatar answered Oct 22 '22 14:10

hyperd