Eduard Baraniak
Eduard Baraniak

Reputation: 431

ODBC or NpgSQL for ASP.NET using PostgreSQL

I have project in ASP.NET with postgreSQL database. I do not know what of connection type is better. On one side I in ODBC we have Server Explorer(drag and drop gridview) and on the other side it is not separate application layer from logic layer. Please what of connection type is better ODBC or NpgSQL and why?

Sometging about my project:

Upvotes: 3

Views: 4955

Answers (1)

Mark Wilkins
Mark Wilkins

Reputation: 41222

In general, I would choose the pure .NET solution over ODBC. I am not familiar with either of these drivers for PostgreSQL, so take this advice with caution. Some "general" arguments are:

  • Because .NET data providers are a newer technology than ODBC, they will as a general rule get more attention and updates than ODBC drivers. This, of course, may not apply in this case (maybe the PostgreSQL ODBC driver has a thriving developer community behind it). Barring that, though, it is more likely that problems you may encounter would be addressed in a more timely fashion in .NET data providers.
  • The client side stack is going to be a bit smaller if using the pure .NET data provider. I saw that Npgsql is a pure .NET solution. An ODBC driver, on the other hand, will have a deeper stack. A call has to go through the ODBC .NET provider, which then makes an unmanaged call to the ODBC driver manager, which then calls the PostgreSQL ODBC driver. Whether or not this would actually have an impact on performance would depend on the application and usage.
  • A pure .NET provider may be more efficient in that it is typically written specifically for a particular database server. In contrast, the ODBC .NET provider has to work with the ODBC driver manager and cannot make assumptions about the back end.

I reiterate that the above statements are general ones that may not apply in this specific case but are probably worth considering.

Upvotes: 8

Related Questions