tovvenki
asked on
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};Serve r=192.168. 0.33;Datab ase=Piba.N et;UID=pos tgres;PWD= ;";
OdbcConnection objLConnection = new OdbcConnection(sMyConnecti onString);
try
{
objLConnection.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.Messa ge);
}
objLConnection.Close();
Can anyone help me in solving the problem.
Thanks in advance
Venki
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};Serve
OdbcConnection objLConnection = new OdbcConnection(sMyConnecti
try
{
objLConnection.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.Messa
}
objLConnection.Close();
Can anyone help me in solving the problem.
Thanks in advance
Venki
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
"User ID=root; Password=pwd; Host=localhost; Port=5432; Database=testdb;Pooling=tr
For more details: http://www.crlab.com/pgsqlnet/
HTH,
Jigit