May 11, 2005

C#, Mono, and Npgsql for PostgreSQL

From February 2004 --

Some of you may know that I'm now more
interested in C# than in Java for the same
reasons I was looking at Java: marketability
of skills and ubiquity of available knowledge.
C# also happens to be a great language, or
so I have heard, faster and more flexible on
a Windows PC than a JRE. Not that I know.

The devil is of course in C# being Windows-
centric, but so are 90% of desktops, and if
one really wants to run C# code atop OS X
or Linux it can be done with the free Mono
framework (a bit immature; wait for ver. 2).
If not Mono, VPC7 is a less-than-ideal but
workable fallback for running .NET apps.

C#, .NET, and SQL Server go together like
beer and salt, but SQL Server isn't the only
database option. I think that maybe I'll try
building .NET Windows front-ends to very
simple PostgreSQL databases hosted on
UNIX. A .NET Data Provider does for .NET
what JDBC does for Java, and Npgsql is a
data provider for PostgreSQL servers. See

If the .NET client does all the connectivity
work using data providers like Npgsql for
abstracting access, then client and server
can remain independently tweakable. That
is, the same data can be also accessed via
PHP or Ruby, and clients can also access
other back-ends like Oracle or SQL Server.

If you are also interested in C# or just want
to heckle, feel free to ask/comment. I deny
being a stooge for M$oft, but resistance is
futile and your species will be assimilated.


--------- example of C# with Npgsql ---------

// in C#
using System;
using System.Data;
using Npgsql;
public class Test
public static void Main(String[] args)
String connstring = "Server=;User
NpgsqlConnection conn = new NpgsqlConnection(connstring);

Posted by tapli005 at May 11, 2005 10:00 AM