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; .......
Related
Can you please help me to connect my C# application with hive database using Cloudera ODBC driver. We are using Kerberos authentication. I am using this connection string:
conn = new OdbcConnection
{
ConnectionString = #"DRIVER={Cloudera ODBC Driver for Apache Hive};
Host=host_name;
Port=10000;
Schema=default;
HiveServerType=2;
AuthMech=1;
KrbRealm=realm_name;
KrbHostFQDN=FQDN_name;
KrbServiceName=hive;
Getting this error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I have been able to setup the User DSN and the Test was successful. I have also tested by just passing the DSN name in the connection string bust still am getting the same error message.
Please help me if you have any solution to this!
I am connecting to a DB2 DB with an ODBC Connection. This Connection string works perfectly when I run the page locally through VS 2017. When I publish the page and try to access the data through postman or a URL, I get the following error
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I was under the assumption that the ODBC driver would take care of this. Here is my very simple connection string.
connectionString = #"DSN=XXX;UID=XXX;Pwd=XXX;";
Any help would be greatly appreciated!
I am setting up an database application to be database agnostic, and when testing with postgresql I get the standard dsn error:
[IM002] [Microsoft][ODBC Driver Manager] Data source name not found
I usually use SQL server and MySQL so I'm new to postgres, I tried the standard recommended Connection string:
"Driver = {PostgreSQL}; Server = localhost; Database = postgres; Port = 5432; Uid = postgres; Pwd = XXXXXX;"
I also tried the name of the odbc driver that I installed after installing postrgesql:
"Driver = {PostgreSQL ODBC Driver(UNICODE)}; Server = localhost; Database = postgres; Port = 5432; Uid = postgres; Pwd = XXXXXX;"
Setting up a DSN in odbc manager also works perfectly using the unicode driver, so I cant understand why i cant connect in my application, is there an error in the driver name that i am using in the connection string?
Your error message looks very strange. It tells about DSN not found. Are you sure you use connect string with Driver=...?
You can use ODBC connect string in several forms. At first you have created DSN, so you can use it:
DSN=mn_test; Uid=postgres; Pwd=postgres;
Then you can use other form of connect string:
Driver={PostgreSQL UNICODE};Server=127.0.0.1; Port=5493; Database=mn_test; Uid=postgres; Pwd=postgres;
Both work on my old 32 bit Windows environment. I test them with simple Python script (I use ActiveState Python in which there is simple odbc module):
import odbc
def test_odbc(connect_string):
print(connect_string)
db = odbc.odbc(connect_string)
c = db.cursor()
rs = c.execute("SELECT version()")
for txt in c.fetchall():
print('%s' % (txt[0]))
print('-----')
test_odbc('Driver={PostgreSQL UNICODE};Server=127.0.0.1; Port=5493; Database=mn_test; Uid=postgres; Pwd=postgres;')
test_odbc('DSN=mn_test; Uid=postgres; Pwd=postgres;')
When you created the DSN, did you create it with the correct odbcad tool? With the 64bit version found in C:\Windows\System32 if your application is 64bit and with the 32bit version found in C:\Windows\SysWOW64 if your application is 32bit?
My code is wrote in C#
I have a problem while connecting to MYSQL remote DB .
The remote DB is 64 bit while the one in local system is 32bit.
The one in 32bit works, the one in remote doesn't.
Im using this version of drivers : " DRIVER={MySQL ODBC 5.3 ANSI Driver}; ", one in 32bit , the other one in 64bit (remote one)
This is the error i got :
System.Runtime.InteropServices.COMException (0x80004005):
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
Anyone has any ideas to deal with this?
Thanks
We are trying to use 64 bit office (2013) from a 32 bit app.
Using the following connection string we are able to access .mdb files.
connection string: Driver={Microsoft Access Driver (*.mdb)};Dbq={Path_To_Db};Uid=;Pwd=;
But when we add *.accdb to the connection string we get the following error for both .mdb as well as .accdb database.
New Connection string: {Microsoft Access Driver (*.mdb, *.accdb)};Dbq={Path_To_Db};Uid=;Pwd=;
Error: [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
On a 32 bit office - the code is working fine.
Any suggestion?