I am trying to link an access database that is .accdb not .mdb . What do I need to do? where am I going wrong?
I have already tried to create it under the ODBC data source admin 32-bit (System DSN) tab. I selected the Driver - Microsoft Access Driver (*.mdb, *.accdb) Data source name = Faunafile and selected the database which I have saved in my c drive. System database is None.
The in QGIs I click on "add vector". click database. in type I choose ESRI Personal GeoDatabase and under connections click New.
Type = ESRI Personal Geodatabase. Name is Faunafile and Database = Faunafile. Then when I try to test connect it comes up with an error message.
This is the error message I get:
Connection failed - Check settings and try again.
Extended error information:
Unable to initialize ODBC connection to DSN for Faunafile,
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
Maybe you're using QGis 64-bits. Try to uninstall it and install QGis 32-bits. I had the same problem and now it works.
Related
I'm trying to connect to an Access .accdb file and read data from my c# project in VS 2019 (.Net Core 3.0). I'm on a 64-bit system, and I believe I have both 32- and 64-bit odbc drivers for Access installed.
I was able to setup a Data connection in server explorer which uses a data source name of "MS Access Database". When I test the connection, it works fine. Also, I can expand the new connection in server explorer, and I can see all of the tables just fine. I right-click the data connection and choose Modify, I can see the data source name is MS Access Database, and if I select "use connection string", the full connection string is
Dsn=MS Access Database;dbq=C:\Brandeis\BNCConejo_Data.accdb;defaultdir=C:\Brandeis;driverid=25;fil=MS Access;maxbuffersize=2048;pagetimeout=5;uid=admin.
As mentioned, when I use either the dsn or the full connection string in the modify connection dialog, clicking the "Test Connection" button gives me a success message. If I use either the DSN or full connection string in my code, I get this error:
ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
Here is a snippet of my code:
using (var conn = new OdbcConnection(connectionString))
{
try
{
conn.Open();
}
catch (OdbcException ex)
{
LastError = "ODBC Error: " + ex.Message;
return null;
}
}
I've tried targeting Any CPU, x64 and x86, but none of them work. They all return the above exception message.
Any idea why the server explorer data connection works, but not the c# code, using the same connection string?
By the way, something went wrong earlier and I seemed to be missing my odbc drivers. I downloaded and ran AccessDatabaseEngine.exe and AccessDatabaseEngine_X64.exe, both with /quiet option so they would properly install. This left me with the odbc drivers available, but still I get the above exception.
UPDATE: The same error occurs when trying to open connection to a MySQL database using a known good DSN entry for MySQL. This DSN is working when using it from a production Access application.
Thanks...
Finally solved this issue by completely uninstalling my 32-bit Office and installing 64-bit office.
In my Access database, I reference the DSN, "mydatasourcename" to connect to an online MySQL database. It is a machine DSN. Somehow through the course of editing my config files, a phantom DSN was created. This DSN is now out of date and I need to update it with the new hostname (after having migrated the MySQL Server). But the config file is nowhere to be found. It does not show up in either 32-bit or 64-bit "ODBC Data Sources" forms. I have searched "mydatasourcename" in the Registry Editor and it is not there either. Mysteriously, when I open an Access linked table referencing "mydatasourcename" it opens a MySQL ODBC Connector dialogue with the old connection information in it. How is it doing this? Where is it getting the connection string information? To answer this question, I am requesting a list of the places the ODBC driver looks for configuration files and how to access them so I can delete the old configuration file. I am using MySQL ODBC Connector 8.0.16. Thank you.
EDIT: The connection string found in my linked table is definitely looking outside of Access for connection info based on the fact that is referencing a DSN. The connection string in one of my linked tables is the following: "ODBC;DSN=mydatasourcename;;TABLE=qrychemigationapplications_materialsrequired1"
On Windows, ODBC DSN information is stored in the Windows Registry. System DSNs can be found in the registry keys
DSNs for 64-bit drivers: HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
DSNs for 32-bit drivers: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI
and User DSNs can be found in
HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI
If a DSN does not appear in the ODBC Administrator (odbcad32.exe) it might be because the DSN name is not included in the list of DSNs in the corresponding subkey
...\ODBC.INI\ODBC Data Sources
Paths to odbcad32.exe:
x86:
%windir%\syswow64\odbcad32.exe
x64:
%windir%\system32\odbcad32.exe
I was able to find the "Machine Data Sources" that Microsoft Access creates in the Windows Registry Here:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\ODBC\ODBC.INI\ODBC
Data Sources
The "Machine Data Sources" that are in this part of the registry, seem to be accessible only via MS Access. If you look for them instead using the standard Windows ODBC Data Source Administrator "widgets" (32 or 64 bit), you just don't see the "Access Created" Machine Data Sources for some reason. If anyone can tell us why, that would be great!
What's more frustrating, is that at least with the latest Microsoft Access Office 365 version, you can only create NEW Machine Data Sources. You can't delete or edit existing "Machine Data Sources".
That being said, if you avoid creating the "Machine Data Sources" using Microsoft Access itself, and instead use the standard 64 Bit Windows ODBC Data Source Administrator "widget", then for whatever reason Access will see those that you create in this way.
So having the issue that you're describing, just seems to be the result of some weird design that Microsoft has implemented specifically in regard to Microsoft Access ODBC connections, for a reason that escapes me.
Hope this helps!
Below is an alternative to accessing the Windows Registry:
Control Panel
Administrative Tools
ODBC Data Sources (32-bit or 64-bit)
Click the tab for: User DSN, System DSN, or File DSN
Click the name of the Data Source
Click Configure... if you would like to view or modify the details of the data source
I can use the following code successfully in the R GUI to connect to a Microsoft Access database:
library(RODBC)
#ODBC connection
scallopchannel<-odbcDriverConnect("scallop_2016")
"scallop_2016" is a DSN for the Access database I connect to.
In RStudio I have to specify to path to the Access database like this:
ODBC connection
scallopchannel<-odbcDriverConnect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=S://Adv/Scallop Central/2015 RSA/2015 RSA Database/2015 RSA Database_9-4-2015.accdb")
Otherwise I get an error message:
Warning messages:
1: In RODBC::odbcDriverConnect("DSN=db2017") :
[RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
2: In RODBC::odbcDriverConnect("DSN=db2017") : ODBC connection failed
When I type to troubleshoot the problem
odbcDataSources ()
RStudio indicates that the Access datasource is there.
This is a pain since I sometimes connect to multiple databases within a session and I prefer to be able to code for just the DSN.
I am using RStudio 1.0.153 and R GUI 3.3.2.
I am also using 32 bit R and 32 bit RStudio.
I have Microsoft SQL Server Report Builder 3.0 that I use from SQL Server Reporting Services 2012. My machine has 64 bit Windows 7. I am able to use report builder fine when I connect to SQL Server DB. Now I want to connect to a MySQL DB (version 5.1.73).
What I have done so far:
1) I have installed 32-bit version of "MySQL ODBC Connector Unicode 5.3.8". I have installed 32-bit version as the Report Builder is a 32 bit application and so needs 32-bit version.
2) Then I have added entry for the MySQL DB in the "System DSN" by selecting the "MySQL ODBC 5.3 Unicode Driver" that i had installed. As my machine is 64 bit, I have added this entry in "System DSN" of "ODBC Data Source Administrator" located at C:\Windows\SysWOW64\odbcad32.exe
3) Then from report builder I am trying to create new Data Set and a new data source connection to this data set. I am selecting connection type as "ODBC" and click on "Build".
4) In "Connection Properties" window I select "Use user or system data source name:" and picking the DSN name that I have added in the "System DSN" tab of "ODBC Data Source Administrator".
5) After I click "Test Connection" it shows "Test connection succeeded".
6) When I click OK on the success message and "Connection Properties" window I come to "Data Source Properties" and see "Connection string:" is set to "Dsn=MySQLforCAD_UAT". MySQLforCAD_UAT is the DSN name I had entered in "System DSN" of "ODBC Data Source Administrator".
The problem: When I click on "Test Connection" from this window, I get error as
What I have tried so far: I have tried selecting "Use connection string" instead of "Use user or system data source name:" and tried few combinations of Dsn=MySQLforCAD_UAT;trusted_connection=Yes
Dsn=MySQLforCAD_UAT;description=<DSN description>;server=<DB Server IP>;uid=<DB user id>;database=<database name>;port=3306
My Questions:
1) Why is report builder saying connection succeeded at one place and failure at the other? How can I correct this so I can connect to MySQL DB?
2) I don't have admin rights on my machine and the "System DSN" entries need admin access to be able to edit/add it. Could this be causing the problem in case if admin access is needed even to use the details I have added in "System DSN" (with help of local admin)
I used a different approach by creating a linked server. To do it, I followed instructions from this link. Thank you to the author (I couldn't find a name there)
I have a connetion problem while connecting to my Access Database. I selected the Database but when i checked the connection, an error message appear : error appear in 'Database configuration' page
when i clicked on details : [Microsoft][Pilote ODBC Microsoft Access] Ressources système insuffisantes.
Take a look at this Talendforge post: http://www.talendforge.org/forum/viewtopic.php?id=9389
You will need to install a driver.