Unable to connect to postgres using Ado.net 1.1

Hi All,
I am trying to connect to postgres from my app using ado.net 1.1 but it always throws the error
"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
the problem is the same code worked when I was using pgAdmin 2. I recently installed PgAdmin III and then the app starts failing to connect to my postgres database. The same is the sample code that I was testing
string sMyConnectionString = "driver={PostgreSQL};Server=192.168.0.33;Database=Piba.Net;UID=postgres;PWD=;";
OdbcConnection objLConnection = new OdbcConnection(sMyConnectionString);
try
{
      objLConnection.Open();
}
catch (Exception ex)
{
      Console.WriteLine(ex.Message);

}
objLConnection.Close();

Can anyone help me in solving the problem.

Thanks in advance

Venki


LVL 21
tovvenkiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Razzie_Commented:
I think PgAdmin III changed the name of your datasource. If you in Windows (XP), go to control panel, administrative tools, Data Sources (ODBC), you should change the driver={PostgreSQL} part to the exact name listed there, maybe it is driver={PostgreSQL 3.0} or something.

HTH,

Razzie
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JigitCommented:
Connection string for Core Labs PostgreSQLDirect (.NET):
"User ID=root; Password=pwd; Host=localhost; Port=5432; Database=testdb;Pooling=true; Min Pool Size=0; Max Pool Size=100; Connection Lifetime=0"
For more details: http://www.crlab.com/pgsqlnet/

HTH,
Jigit
0
tovvenkiAuthor Commented:
HI All,
Thanks for your quick replies, in fact Razzie's post was very useful, it was the driver after installing pgAdmin III I have updated the driver and was now able to connect to the postgres server.

Regards,
Venki
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.