Connection string doesnt work for PostgreSQL
Solution 1
Instead of {PostgreSQL}
use {PostgreSQL ANSI}
or {PostgreSQL UNICODE}
Driver={PostgreSQL UNICODE};Server=127.0.0.1;Port=5432;Database=dbname;Uid=name;Pwd=password;
for more connection strings have a look at: http://www.connectionstrings.com/postgre-sql
You can also configure DSN using ODBC Data Source Administrator and then use created DSN name in ConnectionString:
DSN=dsn_name;Uid=name;Pwd=password;
Look at: https://www.connectionstrings.com/odbc-dsn/
Solution 2
If you are using the 64 bits version of PostgreSQL, then you should use in the connection string:
Driver={PostgreSQL UNICODE(x64)};Server=127.0.0.1; .......
CSharpened
Currently working as a Software Engineer for LJT Systems Ltd
Updated on March 04, 2020Comments
-
CSharpened about 4 years
I am using the following connection string structure in my web.config in order to connect to a PostgreSQL database using ODBC however I get an error:
Connection string
<add name="ApplicationODBCDefault" connectionString="Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=dbname;Uid=name;Pwd=password;"/>
Error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I have downloaded and installed both the 32 bit and 64 bit drivers for PostgreSQL ODBC from Here and it still isn't working. What could be the issue here?
-
Pamungkas Jayuda about 8 yearsIf we develop with X64, use this code work well. How about i build this code and use at i386 ?
-
PiotrKowalski over 7 yearsWith this I got "Keyword not supported: driver". Any ideas why? My code looks like this: "Driver={PostgreSQL UNICODE};Server=*****;Port=5432;Database=IdM_Person;Uid=Guest;Pwd=******;"
-
Elias Ghali about 4 yearsHey, I keep getting this error
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
, although if I use Server Explorer, it connects using PostgreSQL driver, but not with this connection string ! -
Michał Niklas about 4 yearsI added info about using DSN. It may be easier.