ODBC Connector Bitness Issue (I think) on Windows Server 2012 - mysql

I have a 32-bit application that uses a UDL file to connect to a mySQL database on a different host. This 32-bit EXE is running on a Windows Server 2012 R2 VM. There was a HDD failure and I'm reconfiguring the system to connect to the database, so I know this configuration should not be so troublesome.
A snapshot of what is true:
MySQL ODBC Connector (32-bit) 8.0.23 is installed.
I created the connection with a unique DSN in the 32-bit ODBC admin panel.
Testing the connection through the 32-bit admin panel works fine (I can see the schema, etc.).
Here's where things start getting fishy:
When I open the UDL file my application uses to start the connection, the 32-bit DSNs don't show up. If I type them in manually, I get the 'architecture mismatch' error that everyone seems to agree actually means 'bitness mismatch' (If I create a 64-bit DSN, they show up and ping the DB no problem.)
I found this trick to open the UDL file using the 32-bit ODBC driver:
OLEDB is very similar in that there is a 32 bit version and a 64 bit version of the providers. The easiest way to configure and OLEDB data source is to create an .UDL file on the operating system. By double clicking on the .UDL file you will see the OLEDB providers for the 64 bit side of the operating system presented in the Data Link Properties dialog. To get to the 32 bit version of the OLEDB providers you need to execute the following command line from a command shell.
C:\Windows\syswow64\rundll32.exe "C:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\test.udl
...And that works! I can see the 32-bit named connections. The 'Test Connection' button produces happy output. But when I run my application, it does not connect using the DSN/credentials of the UDL file. It behaves like it is still trying to call the 64-bit version of the ODBC driver.
If my assumptions are correct, then how do I get my EXE to prioritize using the correct (x86) 32-bit oledb32.dll? Compatibility mode didn't fix my issue and I've run out of "clever" ideas to try.
Thanks in advance for any suggestions!

Related

SSIS why all connection manager drivers pointing to 32 bit versions?

I was struggling for long time to export data to Excel while running my package in 64-bit mode. Currently I have set Runtime64bit to false to get job done but I really want to run in 64-bit mode for some strong reasons.
For that I have installed AccessDatabaseEngine_X64.exe (after uninstalling existing drivers). But I still get unable to acquire connection error. I have to run in 32 bit mode even after installing 64-bit driver. What is wrong?
What I have noticed is that when I creating a new Excel connection the connection manager dialog box is showing the drivers path pointing to 32 bit version. When I looked at other drivers, they are also pointing to 32-bit version. (see screenshot below). Is there anything to do with this?
My Environment:
- Windows Server 2012 Standard (64-bit)
- MSSS DT 2012
- MS Excel 2010 (64-bit)
- MicrosfotAccess Data Engine 2010 (64-bit)
My Excel file is saved in 97-2003 format (.xls)
Let me quote this FAQ - How to run SSIS Packages using 32-bit drivers on 64-bit machine
On 64 Operating System when you install Integration Services it will
install 32-Bit and 64-Bit version of DTExec commandline tool which is
used to execute SSIS packages.
DTExec 32-Bit can be found under : C:\Program Files (x86)\Microsoft
SQL Server\90\DTS\Binn
DTExec 64-Bit can be found under : C:\Program Files\Microsoft SQL
Server\90\DTS\Binn For more information click on the following URL
http://msdn.microsoft.com/en-us/library/ms162810.aspx
If your SSIS package is referencing any 32-Bit DLL or 32-Bit drivers
from your package then you must use 32-Bit version of DTExec to
execute SSIS package.
-- EDIT --
Extended explanation by example.
Imagine you create a new SSIS package. In it you connect to an Excel file. For this to work, you need to have MS Office, or the Microsoft Access 2016 Runtime
in the machine that is executing the package.
So, you are creating the package in VS in your desktop. You have Office 32 bit installed and it all works fine.
When you deploy to the serve, in this case a Windows 2012 (64 bit). You think that... STOP! The bit of the server does NOT matter. OK, but my SQL Server is 64 bit so... NO, it does not matter neither!
Once an SSIS package is published, look at the scheduled job properties. In there you can specify to run in 64 or 32 bit mode.
Depending on this you need to have the correct version of drivers installed!
Run the SSIS package on 64 bit; install 64 bit drivers!
Run it on 32 bit; then install the 32 bit drivers!
But I still get unable to acquire connection error. I have to run in 32 bit mode even after installing 64-bit driver. What is wrong?
When you execute your package and look at the Progress tab, you will no doubt be getting an error message similar to:
[Connection manager "Excel Connection Manager"] Error: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".
When you set up your Excel Connection Manager, choosing Excel 97-2003 file type will default to the Microsoft Jet OLEDB driver which is available as a 32-bit version only.
Assuming you have the 64-bit Microsoft Access Database Engine 2010 Redistributable still installed, what you need to do is click on the Excel Connection Manager you created in the Connection Managers tab. In the Properties pane, look for the ConnectionString property (under Misc if grouped by category).
You'll see the Provider is set as Provider=Microsoft.Jet.OLEDB.4.0, the 32-bit only driver. If you had chosen "Excel 2007" as the file type it would have used Microsoft.ACE.OLEDB.12.0 which is 32-bit or 64-bit depending on which Microsoft Access Database Engine Redistributable you installed.
Change the Provider to Microsoft.ACE.OLEDB.12.0 in the ConnectionString property. When you change this, you'll notice errors appear in the Error List pane similar to:
Error 1 Validation error. Data Flow Task 1: Package: The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 32-bit driver is not installed, run the package in 64-bit mode. Error code: 0x00000000. An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered". Package.dtsx 0 0
Error 2 Validation error. Data Flow Task 1: Package: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=219816 Package.dtsx 0 0
These errors are related to SSDT and a point you made earlier which was:
When I looked at other drivers, they are also pointing to 32-bit version. (see screenshot below). Is there anything to do with this?
SQL Server Data Tools is a 32-bit application and is likely the reason why in the "Add SSIS Connection Manager" dialog you are seeing the Connection Managers pointing to 32-bit versions. Requests for 64-bit SSDT have been made quite some time ago. It also the reason these new errors are appearing pre-execution and in a pop-up message box if you attempt to execute your package.
Notice the errors are validation errors which hints at the solution.
Select your Excel Connection Manager, set the DelayValidation property to False. This will stop pre-execution errors showing. Secondly, either for the Package or for the Control Flow task that uses your Excel Connection Manager, set the DelayValidation property to False. This allows you to run the package and stop the errors at runtime.
Check if you have both versions of the DtsDebugHost.exe installed.
If you do you might need to install the latest service pack for Windows Server 2012.
reference

Microsoft.ACE.OLEDB.12.0 is not registered

I have a SQL Server job that runs monthly that runs in server. Job is using an SSIS package and is supposed to extract the data from database and and create an Excel sheet and copy the data into Excel 2003.
I actually got around 140,000 rows from the database due to truncation issue in Excel 2003 (Excel supports 64,000 rows). So I modified the config file to support 2007 Excel format.
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + #[User::FullPath] + ";Extended Properties=\"Excel 12.0;HDR=YES\"
But when I try to execute the job, it fails showing error message:
"The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered"
Summarized: INSTALL 32 bit version of Microsoft Access Database Engine 2010 Redistributable. Uninstall 64 bit version if previously installed. http://www.microsoft.com/en-us/download/details.aspx?id=13255
The Excel connection manager is trying to use the ACE OLE DB provider in order to access the Excel file when the version is above 2007 (xlsx).
Although your box is 64-bit, you’re using SQL Server Data Tools, which is a 32-bit application. There is no 64-bit version for SSDT. When you design your package within SSDT, you’re using a 32-bit process, which can only use 32-bit providers. When you try to choose the table in the Excel file, the connection manager needs to access the 32-bit version of the ACE OLE DB provider, but this provider is not registered on your machine, only the 64-bit version is installed.
You should download the 32-bit version of the “Microsoft Access Database Engine 2010 Redistributable”. When you try to install it, you might get an error message.
You should first uninstall only the 64-bit version of the “Microsoft Access Database Engine 2010 Redistributable”, which you probably installed previously. The 64-bit version and the 32-bit version can’t live together on the same host, so you’ll have to uninstall (through “Program and Features”) and install the other one if you wish to switch between them.
Once you finish uninstalling the 64-bit version and installing the 32-bit version of the provider, the problem is solved, and you can finally choose the table within the Excel file. The Excel connection manager is now able to use the ACE OLE DB provider (32-bit version) in order to access the Excel file.
There is a alter way. Open the excel file in Microsoft office Excel, and save it as "Excel 97-2003 Workbook". Then, use the new saved excel file in your file connection.
Another option is to run the package in 32 bit mode. Click on the solution => properties =? Debugging => Set run in 64 bit to false.
I think you can get away by just installing the OLEDB Drivers -
http://www.microsoft.com/en-us/download/details.aspx?id=13255
I installed the "Microsoft Access Database Engine 2010 Redistributable" as mentioned above and got side-tracked troubleshooting bitness issues when it seemed to be a version issue.
Installing "2007 Office System Driver: Data Connectivity Components" sorted it for me.
https://www.microsoft.com/en-us/download/details.aspx?id=23734
The easiest fix for me was to change SQL Agent job to run in 32-bit runtime.
Go to SQL Job > right click properties > step > edit(step) > Execution option tab > Use 32 bit runtime
screenshot
You have probably installed the 32bit drivers will the job is running in 64bit. More info: http://microsoft-ssis.blogspot.com/2014/02/connecting-to-excel-xlsx-in-ssis.html
The easiest solution I found was to specify excel version 97-2003 on the connection manager setup.
I followed the instructions to use the /passive switch here, after downloading the 64 bit Access database engine. I'm running Office 32-bit, SSAS Tabular Model in SQL Server 2012. When I downloaded and ran the 64-bit Access database engine it came up with a message saying that I couldn't install this without first uninstalling Office 2010, but the /passive switch seems to have solved this (I can now import Excel workbooks and Access tables in a tabular model).
I was getting this same error after previously being able to complete similar operations. I didn't try downloading any of the mentioned packages since I didn't have them previously and things were working. IT at my job did a 'Repair' on Microsoft Office 2013 (Control Panel > Programs > Add/Remove - Select Change then Repair). Took a few minutes to complete but fixed everything.
Just install 32bit version of ADBE in passive mode:
run cmd in administrator mode and run this code:
AccessDatabaseEngine.exe /passive
http://www.microsoft.com/en-us/download/details.aspx?id=13255
I had this issue and it took me a lot of time to figure this out. #tara's answer helped me to solve this problem but I couldn't really find the setting to set run in 64 bit to false. So, here is the screenshot for where you can find the setting
If anyone is still struggling with this and have done all the above suggestions and Cry every time someone says install Database Access Engine. This is what sorted for it for me.
Install 32bit Database access engine as others have suggested.
Set to run in 32bit mode within Visual Studio
Set to run in 32bit mode on the Job Step within the job on SQL Server Agent. On the Step, General Advanced. Check 32-bit runtime.
I'd post some images but I don't have enough rep :(

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)"

Server 2008r2 x64 and ODBC Connector

server 2008r2 x64,
mysql 5.5.24 x86,
access 2007 x86
im trying to connect mysql backend to access 2007 frontend...
after I installed mysql-connector-odbc-5.1.12-win32.msi and rebooted server. that driver will not show up in the drivers tab of ODBC Datasource administrator.or in the list of drivers if i try to add a new driver
also installed mysql-connector-odbc-5.2.5-win32.msi also just to try newer version, that does not show up either. repaired both install, rebooted, reinstalled, same thing. all i see is a mysql driver...
any ideas whats going on?
UPDATE:
Used C:\Windows\system32\odbcad32.exe and same results.. no driver there...
really not sure whats going on... any special dependancies required? not sure what i could be missing.. as i said, neither driver is visible, yet both installed without error (to my knowledge, are there install logs???)
default path for both drivers during installation was c:\programs Files (x86)\MySQL\connector ODBC 5.1\ or c:\rograms Files (x86)\MySQL\connector ODBC 5.2\
any thoughts?
After installing 32-bit ODBC components onto a 64-bit machine you need to run the 32-bit ODBC Administrator, normally found at
C:\Windows\SysWOW64\odbcad32.exe
If you just go the normal Control Panel > Administrative Tools > Data Sources (ODBC) route then you will be looking at the 64-bit environment, and your 32-bit options will not be visible.

How do I connect to MySQL using 32/64-bit ODBC drivers from within SSIS?

I have written an SSIS package and I'm having trouble with connecting to the MySQL server.
Ive tried both .NET connector and ODBC and I've hit issues with both.
The .NET connector has a known issue with dynamic queries and gives an error regarding not finding column P1 (which is a variable).
The recommended route to get past this is to use ODBC to connect. When i use the ODBC connector i get an error regarding memory issues with connecting to MySQL.
I have installed both 64 and 32 bit ODBC MySQL drivers and setup my ODBC connection, but it doesn't fix my issue.
I have tried just entering a connection string, but this leads me back to the memory error.
When reading some online guides it mentions two different Data Sources needing to be setup, one for 32-bit and one for 64 bit, but in Windows 7 I cannot see a 64 bit Data Sources program?
I have also found people mention using a specific mysql.data.dll file but i cannot find this file nor where to put it or reference it.
Read the below Microsoft KB to find the executables location to configure the 32-bit and 64-bit ODBC data sources. You need to configure the appropriate ODBC source so you can view it in BIDS or make the SSIS package run within an SQL Server Agent job.
Microsoft KB 942976
32-bit version of Odbcad32.exe file is in %systemdrive%\Windows\SysWoW64 folder.
64-bit version of Odbcad32.exe file is in %systemdrive%\Windows\System32 folder.
System drive would be the drive where you have installed the operating system.