Trying to connect to an access with a UDL file - ms-access

I'm trying to connect to an Access database via a UDL file. I'm wanting to generate a connection string so that I can connect to an access database via ADO.NET. It's been a few years since I've tried to do this.
I have Visual Studio 2015 Pro and Microsoft Access 2016 installed on my Windows 10 x64 pro machine. When I create a .udl file I have the following available options:
Microsoft OLE DB Provider for ODBC Drivers
Microsoft OLE DB Provider for Search
Microsoft OLE DB Provider for SQL Server
Microsoft OLE DB Simple Provider
MSDataShape
OLE DB Provider for Microsoft Directory Services
SQL Server Native Client 11.0
I think that in years past I would also see Microsoft Jet 4.0 OLE DB in this list. From the research I've done I think that Jet 4.0 is deprecated and that I should be using the Access Database Engine. I find the following versions that I think are that:
Microsoft Access Database Engine 2010 Redistributable
Microsoft Access 2013 Runtime
Microsoft Access 2016 Runtime
I downloaded the x64 version of Microsoft Access 2016 Runtime and when I try to install it I get the following error:
We can’t install the 64-bit version of Office because we found the following 32-bit programs on your PC:
Office 16 Click-to-Run Extensibility Component
Please uninstall all 32-bit Office programs, then retry installing 64-bit Office. If you want to install 32-bit Office instead, please run the 32-bit setup.
I've tried the 32-bit version of the Microsoft Access 2016 Runtime and I get the same message:
We can’t install the 32-bit version of Office because we found the following 64-bit programs on your PC:
Office 16 Click-to-Run Extensibility Component 64-bit Registration
Please uninstall all 64-bit Office programs, then retry installing 32-bit Office. If you want to install 64-bit Office instead, please run the 64-bit setup.
I've tried closing all open Microsoft Office and Visual Studio applications and I get the same error. Am I installing the right component? Any way to get it to install correctly?

You probably miss the ACE driver listed here - and only this, not the runtimes:
Microsoft Access Database Engine 2010 Redistributable

Related

Microsoft Access Database Engine 2016 - issues with certain SQL queries that work fine with 2010

I have an app that's been working fine in 32 bit using the connection string:
Driver={Microsoft Access Driver (*.mdb)}; Dbq=MyDatabase.mdb;
using ADO in C++ on a PC with no Office installation.
I have converted it to x64 and I believe I need to install some form of Access drivers no matter if the host PC has x64 Office installed or not. So I grab Microsoft Access Database Engine 2016 Redistributable and install it.
In general everything works OK but certain SQL queries are failing. Most noticeably ones that use LIKE '%somevalue%' - now I understand that % is ANSI-92 but it's been working fine as I say so assume that's ADO related (I could change this to ALIKE I guess).
What I don't understand is if I install the Access Database Engine 2010 then all works as expected. It seems that something is different in the Access Database Engine 2016. I did look for some release notes/breaking changes but couldn't find anything.
So my question is are there changes in the way SQL is parsed in Microsoft Access Database Engine 2016 and should I simply get customers to install the 2010 version?
Note: the other query that seems to be failing is a table with a Yes/No field. I have a query that checks: field <> 0 and this throws an exception.
Update: If I install the Microsoft Access 2016 Runtime then all seems to work. So the issue seems specific the Microsoft Access Database Engine 2016
So in summary:
No Office Installed: Installed Access 2016 x64 Database Engine: Query FAILS
No Office Installed: Installed Access 2010 x64 Database Engine: Query PASSES
32bit Office Installed: Installed Access 2016 x64 Database Engine: Query FAILS
32bit Office Installed: Installed Access 2010 x64 Database Engine: Query PASSES
x64 Office Installed: Installed Access 2016 x64 Database Engine: Query PASSES
Where the Query is:
SELECT * from sometable WHERE somefield LIKE '%ABC%';
The setup is:
Window 10 Version 1909
32 bit Office: Microsoft Office MSO 16.0.12325.20280 32bit
64 bit Office: Microsoft Office MSO 16.0.12325.20280 64bit
Access database engine (x64) from here: microsoft.com/en-us/download/details.aspx?id=54920
My app is x64
Are you using SQL Server as the backend database, or Access?
In SQL Server % is the wildcard symbol.
With a pure Access environment, the wildcard standard is usually *
There may be a setting to change this, but I can't recall.
reference: https://support.office.com/en-us/article/like-operator-b2f7ef03-9085-4ffb-9829-eef18358e931

Missing ACCDB database drivers

Please explain this one to me ....
I am on a x64 bit computer (well, not literally standing on it :) ). And I have Office x64 installed, including x64 Microsoft Access.
Using Access I can open ACCDB and MDB files. yet, if I run the x64 ODBC Drivers component there is NO Microsoft Access Database (*.mdb, *.accdb) driver listed.
The only way I can get it listed is if I install the x64 Access 2013
Runtime. Then it shows up.
Why is it not showing if I have access only installed?
Basically, I am trying to detect if my own executable is going to be able to open the ACCDB database OK. I do that by examining what drivers are installed.
I had the same problem on a 64 bit Windows 10 system with 64 bit Office 2016. I was missing 64 bit ODBC Access drivers. Listing drivers (from Python's pyodbc module) showed only:
'SQL Server'
'PostgreSQL ODBC Driver(ANSI)'
'PostgreSQL ODBC Driver(UNICODE)'
I installed the Microsoft Access Database Engine 2016 Redistributable from Microsoft's site and it came with the extra drivers needed. I could then list:
'SQL Server'
'PostgreSQL ODBC Driver(ANSI)'
'PostgreSQL ODBC Driver(UNICODE)'
'Microsoft Access Driver (*.mdb, *.accdb)'
'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)'
'Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)'
'Microsoft Access Text Driver (*.txt, *.csv)'
And I was able to query an accdb file using the ODBC drivers from Python.
Downloading from the Microsoft Access Database Engine 2016 Redistributable at https://www.microsoft.com/en-us/download/confirmation.aspx?id=54920 also worked for me. It may go without saying, but I think it's worth noting that if your application/executable uses 32-bit drivers and you download the 64-bit Access Database Engine, the 32-bit application/executable may not recognize the Microsoft Access Database (*.mdb, *.accdb) driver.

Using the correct mySQL ODBC driver in windows

I am trying to connect MS Access with a local mySQL database.
To do this I downloaded the mySQL ODBC connector from the mySQL website and installed it. As I am on a 64-bit system I went for the 64-bit version.
I then discovered when trying to connect Access to mySQL that my installation of Office is actually 32-bit so the driver doesn't work. So I removed the 64-bit ODBC driver and installed the 32-bit one.
Problem is, when I go into control-panel -> Administrative Tools -> Data Sources (ODBC) and try to add a new data source, the only options for the mySQL drivers seem to point to the old directory where the 64-bit drivers were. It then fails as it can't find the dlls with system error 126.
How do I get it to show the 32-bit drivers?
Run the 32-bit manager by running this command:
c:\windows\syswow64\odbcad32.exe
Also you can use RegisterDatabase() function to create connection from your code.
I wrote wrapper function many years ago:
http://5codelines.net/kak-programmno-sozdat-odbc-dsn/.
Just skip russian language and use the code.
Prior to installing the ODBC MySQL driver 5.2.6 you need to install the Microsoft Visual C++ 2010 Redistributable Package for x64 or x86 or both (just search the Microsoft site for these and download from there). Other driver versions may require different versions of this MS VC++ Redist. Package, which can coexist side by side. By default server 2008 R2 comes with the 2008 version, so installing the 2010 is required. Before installing check in Programs and Features if not already installed. Depending on you application it may require the 32 bit or the 64 bit version. Without it you get the system error 126
Then install the drivers:
To install the 32 bit version run as administrator c:\windows\syswow64\odbcad32.exe which is the 32 bit version of "Data Sources (ODBC)"

SSIS 2012 & Excel 2010 provider issue

I am using windows 7 64 bit,VS 2010 and MS Office 2010. Trying to build an ssis pkg using an excel source, the problem arises as below.
Could not retrieve the table information for the connection manager 'Excel Connection Manager'.
Failed to connect to the source using the connection manager 'Excel Connection Manager'
I found some solutions on internet, tried these steps by
1) installing the MS access database engine 2010 redistributable_x64.exe. I restarted the system, But still the problem persists. i couldnt find the provider in the list of providers in the oledb source and so selected the jet 4.0 oledb provider and changed the extended properties to Excel 12.0, then i get the following error:
Test connection failed because of an error in initializing provider. Could not find installable ISAM.
and also if i use excel source, its throwing me an error as given above on the top.
2) Also, changed the run 64bit runtime to false and also back to True again.
3) tried to change the platform of the project , but it is disabled.
Could yopu please help me. Thanks in advance.
You need to install the 32 bits provider.
Even though your windows is 64 bits, the SSDT development environment is a 32-bit environment. The reason why you cant find the provider in the list of providers is because it only shows 32-bit data providers. You can only see 64-bit providers that have a 32-bit version available on the development machine.
Though its bit late but might to very helpful for other guys.
Visual Studio 2010/2012 comes with 32-bit version only and hence it cannot use ACE OLEDB 64-bit version, which comes with installation of office 2010 64-bit version.
So the solution here would be uninstall 64-bit version office 2010 and install it's 32-bit version. Re-try to add the excel connection manager.
This has resolved my issue and hope for other guys as well.

My c# application cannot connect to database on window7 64bit with microsoft access database engine 2010 32bit

I'm working with
1) Window7 32bit
2) VS 2005
3) language: C#
I made an application that connects to an Access file and deployed the applicatioin with Clickonce on my computer.
I published in release/any cpu mode.
The prerequisites was .Net Framework 2.0.
When I installed the appliction on another computer (Window7 64bit, MS Access Database Engine 2010 32bit), an error occurred.
The error message was Cannot Connect to Database.... System.Data.
My connection string is Provider=Microsoft.ACE.OLEDB.12.0;Data Source=....
64-bit and 32-bit components don't play well together.
I had a similar issue with 64-bit Windows and a 32-bit ODBC driver. You most likely need the 64-bit version of the Access database driver.