Error on adding *.accdb to connection string - c#

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?

Related

Connect C# to Hive using cloudera ODBC driver

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!

DB2 connection string failing

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!

Postgresql odbc driver error c# [IM002] [Microsoft][ODBC Driver Manager] Data source name not found

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?

Connection string doesnt work for PostgreSQL

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; .......

MYOB ODBC connection error

I recently got a prebuild application which is uses a MYOB ODBC connection to a MYOB file.
The ODBC connection works perfectly in that application.
I'm using the same ODBC connection string in another application but it failed to open in that application. The connection string is perfectly identical but it won't work there.
The error I'm getting is:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
The server explorer in Visual Studio 2008 connects without a problem with the same connection string.
Is it a trusted application issue because my new application is not digitally signed at the moment?
OdbcConnection odbc = new OdbcConnection("Driver=MYOAU0901;TYPE=MYOB; UID=Administrator; PWD=; DATABASE=C:\\Premier125\\Clearwtr.MYO; NETWORK_PROTOCOL=NONET; DRIVER_COMPLETION=DRIVER_NOPROMPT;;KEY=****");
odbc.Open();
The key used in the connection string is definitely valid.
kindly help me.
MYOB ODBC does not require your application to be signed. The company file must be registered for ODBC to allow reads, and you must install a licence key to allow writes. I am assuming your new application is running on the same machine as the company file and MYOB executable, and that your company file is properly registered.
Try setting the KEY parameter to the key itself, not a path to a key file.
Replace ;; with ;
Include the key HOST_EXE_PATH in your connection string. This is the path to the MYOB executable (in your case this will be myobp.exe).
If you still have no luck, try setting up a User DSN. This will allow you to test whether everything is installed correctly. If the DSN works, you can try replacing your connection string with a reference to the DSN, so "DSN=YourDsnName".

Categories

Resources