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?
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/
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; .......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With