I am trying to port a large application from Windows XP to Windows 7. This application MUST work on both platforms side by side as I have 22 client machines and they are all currently Windows XP but will one by one over time be converted to Windows 7.
I have a MySql database that works fine in XP and has been for a few years. On my first Windows 7 machine, it fails when I run the line of code to open a connection to the db:
MyOdbcConnection.Open()
The error is "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
To try to fix it, I downloaded the latest ODBC 5.2 drivers from MySql. I downloaded BOTH the 32bit and 64bit ones. I went into the ODBC Data Source Administrator for BOTH the 32bit and 64bit and added my datasource successfully for this db for a User DSN, System DSN, and File DSN. I can also successfully connect to the db from the MySql workbench.
This is my connection string. It's the same as the other working machine except that one is using the 5.1 driver.
Dim MySqlConString As String = "DRIVER={MySQL ODBC 5.2 Driver};" & _ "SERVER=myserver;" & _ "DATABASE=mydb;" & _ "UID=root;" & _ "PASSWORD=mypw;" & _ "OPTION=3" – Jason Shoulders 3 hours ago
Despite being able to add the data source and connect to the db via workbench, I continue to get an error when I run my exe. Any suggestions?
Apparently I needed to have:
DRIVER={MySQL ODBC 5.2w Driver}
Seems lame. I'm not sure where the "w" came from.
There is little point in adding a user, system and file DSN as your code is not using any of them. You are using what is usually referred to as a "DSN-less" connection. If you were using any of your created DSNs your connection string would be "DSN=my_created_dsn" or FILEDSN=path_to_file. As you are using "DRIVER={xxx}" all you are doing is telling the ODBC driver manager which driver to load and the other attributes in the connection string tell the driver what mysql db to connect to. The name you use for xxx needs to be exactly the name of the driver as shown in the odbc drivers tab. If you are going to continue connecting like this you can delete all your DSNs.
Your 32bit program will not find a 64bit odbc driver. Try setting up the 32bit driver with the following in a command window
%WINDIR%\syswow64\odbcad32.exe
I'm using Visual Fox Pro 9.0 under Windows XP Pro SP3 with 32 bit
I had the same problem but id did NOT work with:
Driver={MySQL ODBC 5.2a Driver} or with Driver={MySQL ODBC 5.2w Driver}
IT WORKED!!! with:
Driver={MySQL ODBC 5.2 ANSI Driver} or with Driver={MySQL ODBC 5.2 UNICODE Driver}
Try it.
Related
Problem Connecting SQLServer2016x64 using LinkedServer to MySqlx32
I'm migrating a working system from Windows2003x32 with SQL2005x32 and MySqlx32 to Win2012R2x64 with SQL2016SP3x64 and MySqlx32
on the old system back I am still sucesfully using LinkedServer to read and write to MySql from SQL. With MySql ODBC 3.51 Dreiver.
On the new server I tryed a bunch of options all resulting in DSN architecture mismatch.
What I did:
I installed MySql-connector-odbc-3.51.30-win64 (later I tryed v5.1.13 and 5.3.14 both 32 and 64 versions)
Using odbcad32.exe from System32 and/or SysWOW64 (tryed both) I sucefully added under System DSN the datasource and tested Ok.
From SQLServerManager I tryed to add linked server using
EXEC master.dbo.sp_addlinkedserver #server='SVTPASS', #srvproduct='SVTPASS', #datasrc='SVTPASS',
#provider='MSDASQL',
#provstr='DRIVER={MySQL ODBC 3.51 Driver}; SERVER=LOCALHOST; Port=3333; USER=******; PASSWORD=********; OPTION=3; DATABASE=svt_fpc_auth'
later tryed using "DRIVER={MySQL ODBC 5.3 Driver}" and "DRIVER={MySQL ODBC 5.3 Unicode Driver}"
But the strange thing is that whatever I try, even writing nonsense at DRIVER={} the same architecture mismatch error I get.
When testing the connection of linked server I recieve the following error:
"[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application"
where am I doing it wrong?
I know that I'm trying to acess a 32bit MySql from 64bit SQLServer but there should be a solution.
I read many forum posts about this issue and tryed a few options suggested here and there, but I'm confused and and I don/t even know now what combinations I tryed and what I didn't tryed yet.
Can someone help with at least telling what are the right weapons to use to fight this issue...
Thanks in andvance
I solved my own problem
I new that I had to create the DSN from 64 version of odbcad32 but
The problem was that I was trying to launch odbcad32.exe from SysWOW64 folder but it launched an created the DSN in 32 bit state. Only when I launched it from windows apps it worked and created the DSN in 64 bit.
thanks aniway
I don't know what to do with this thread/question in this case. please advise
I am trying to run a Classic ASP application on Windows 8.1. It keeps on failing with error: data source name not found and no default driver specified
I am using an Access database. I have the same problem using a MySQL database. I tried with both 32 bit and 64 bit MySQL drivers -- first installing one then uninstalling and then installing the other.
driver={MySQL ODBC 5.3 Driver};option=3;server=localhost;user=root;password=;DATABASE=test;
I'm using these MySQL ODBC drivers:
mysql connector 5.3.4 - win32
mysql connector odbc 5.3.2 - winx64
Access can't be accessed through the MySQL drivers (they're for MySQL not Ms Access), what you need is the Microsoft OLEDB database connections.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
Jet OLEDB:Database Password=MyDbPassword;
Source; https://www.connectionstrings.com/access/
Also for MySQL, if you're running a 32bit MySQL server on a 64bit machine the standard ODBC management tool won't work since it's the 64bit version by default.
You'd need to install in on the 32bit ODBC manager here c:\Windows\SysWOW64\odbcad32.exe
Once that's done you'd need the following connection string to work with a 32bit DB on a 64bit machine. Provider=MSDASQL;Driver={MySQL ODBC 5.2 ANSI Driver};Server=localhost;
Database=myDataBase;User=myUsername;Password=myPassword;Option=3;
Source; https://www.connectionstrings.com/mysql-connector-odbc-5-2/
it seems i can't make work a connection to MySql using ODBC connector 5.2.6.
In a 64 bit environment, in a VBA excel application, i use this string, but it not work:
"Driver={MySQL ODBC 5.2
Driver}; Server=myserver;Database=mydb;User=readonly;Password=mypass;Option=3"
I have also used
Driver={MySQL ODBC 5.2w Driver}
and
Driver={MySQL ODBC 5.2a Driver}
But the error is: ODBC driver unknow.
Can someone help me ?
Ps: it works with a DSN setted, but i would like to use a connection string so i don't go to each user computer and set a DSN.
Thanks
Quick Answer
Make sure you have installed the correct ODBC version (64-bit or 32-bit), matching the software.
Try the following:
Replace Driver={MySQL ODBC 5.2w Driver} with Driver={MySQL ODBC 5.2 Unicode Driver}
Replace Driver={MySQL ODBC 5.2a Driver} with Driver={MySQL ODBC 5.2 ANSI Driver}
Long Answer
The Driver={driver name} part of an ODBC connection string is the driver name that is listed in the Data Sources (ODBC) dialog.
Because you are running in a 64-bit environment, what you do next depends on whether you are running Excel (or whatever the software, web app etc.) as 32-bit or 64-bit, and therefore make sure you've installed the appropriate MySQL ODBC driver version. This is probably the most common problem people run into with ODBC drivers on 64-bit systems.
For those running web servers and trying to get 32-bit ODBC drivers to work in their 32-bit web app, make sure you enable 32-bit applications on the application pool. Here is a forum post describing how to do this: http://forums.iis.net/post/2023543.aspx
64-bit
If the software is 64-bit then open the Run dialog box, and run %windir%\System32\odbcad32.exe.
Click the Drivers tab, and find the MySQL ODBC driver listed, remember the name in the Name column, and use that in the connection string.
For 5.2.6 this will most likely be: MySQL ODBC 5.2 Unicode Driver
Where the driver name you tried before was 5.2w use the Unicode driver, where it was 5.2a use the ANSI driver.
32-bit
If the software is 32-bit then in the Run dialog box run %windir%\SysWOW64\odbcad32.exe to open the 32-bit Data Sources dialog, and then do the same as above.
On 64-bit machines using the 32-bit driver, it is recommended to start the connection string with Provider=MSDASQL;
I had a similar problem with Access 2010/2013 and windows 7. I assumed that I needed the 64 bit driver for a 64 bit environment and could not make a connection whatever I did. I finally downloaded and installed the 32bit version and am now able to connect to MySQL database on a remote server. As Excel is an also Office product I expect the problem/solution is the same.
I am trying to connect to MySQL from my local machine located on a server using VBA. Initially I was receiving the below error.
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
After some research, I figured out that the MySQL ODBC driver should be installed first. I installed the driver from the below location.
http://dev.mysql.com/downloads/connector/odbc/
I have a 64 bit machine and so I installed the driver for 64 bit and tried to establish the connection. Even then I was receiving the same data source name not found error. However from the ODBC data source administrator, if I select System DSN, I am able to see MySQL driver installed and I am able to create a new data source for my database in the server.
However from VBA, if I call the data source I receive another error.
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application.
This is how I am calling the data source from my VBA.
Dim oConn As ADODB.Connection
Set oConn = New ADODB.Connection
oConn.Open "data_source_name"
Also,for the 64 bit ODBC connector I am able to see two drivers as below in my System DSN.
MySQL ODBC 5.2 ANSI Driver
MySQL ODBC 5.2 Unicode Driver
For both of the drivers, my connection is successful from the ODBC data administrator.
I tried to figure out a solution for the architecture mismatch problem and I read if I create the DSN by running the ODBC application from the below location on a 64 bit machine, it might work.
C:\Windows\System32\odbcad32
However for this scenario too, I received the same architecture mismatch error.
I even tried installing MySQL Connector/ODBC 5.2.5 32 bit in my machine. For this case, I am not able to see the driver listed in the system DSN.
Can someone help me figure out what am actually doing wrong?
I can select and loop thru results sets and do inserts. data verified in db. let me know if you need help
windows 7 Ultimate
version 6.1 (build 7601: service pack 1)
64 bit
************************************************************************
ODBC Data Source Administrator
run by command: %windir%\system32\odbcad32.exe
2 drivers:
MySQL ODBC 5.2 ANSI Driver , 5.02.05.00, Oracle, MYODBC5A.DLL, 4/4/2013
MySQL ODBC 5.2 Unicode Driver , 5.02.05.00, Oracle, MYODBC5W.DLL, 4/4/2013
************************************************************************
create System DSN, named hp
using Unicode Driver
dsn=hp
descr=hp
tcpip server=192.168.1.11
user=root
password=xxxxx
Database=test
************************************************************************
ODBC Data Source Admin tool
far right tab called About
Admin, Control Panel, Cursor Library, Driver Mgr, Localized R DLL, Unicode Cursor Lib all Version 6.1.7601-ish
************************************************************************
MSFT Office Professional Plus 2010
Version 14.0.6129.5000 (64 bit)
VBA 7.0
Tools Menu / References / References - VBAProject, scroll down, click on:
Microsoft ActiveX Data Objects 6.1 Library
References Location= c:\program files\common files\system\ado\msado15.dll
************************************************************************
code same, get into an excel Macro:
Sub Macro1()
'
' Macro1 Macro
'
Dim oConn As ADODB.Connection
Dim rsPass As ADODB.Recordset
Dim sql As String
Set oConn = New ADODB.Connection
oConn.Open "hp"
Set rsPass = New ADODB.Recordset
sql = "select * from charlie1"
rsPass.Open sql, oConn
rsPass.Close
sql = "insert into charlie1 (billybob,birthdate,funny_num) values (5,now(),383.111)"
rsPass.Open sql, oConn
End Sub
Run Task Manager and look for EXCEL.EXE - most likely it has *32 after it (the issue is you are running a 32-bit version of excel, attempting to use the 64-bit version of MySQL Connector/ODBC).
To resolve:
Be sure to remove any defined ODBC data sources (DSNs) before
uninstalling the 64-bit driver (unable to remove if the driver is
already uninstalled)
Uninstall 64-bit MySQL Connector/ODBC driver
Download and install 32-bit version of MySQL Connector/ODBC driver
To setup DSN, see this http://forums.mysql.com/read.php?37,357786,360776#msg-360776
Note: You may be able to have both the 64-bit and 32-bit drivers installed and therefore not require uninstall of the 64-bit version. I did not need both so I haven't tested whether it is possible to have both installed.
I was recently fighting with this problem myself.
Taking advice from iOSdedude, I followed the link you originally posted, downloaded the 32-bit driver, and my ODBC connection started working again.
I am running Windows 7 on and my OS shows 64-bit under My Computer --> Properties --> System Info, so I was surprised to see that the 64-bit driver didn't work.
Not a good explanation as to why this works, but it worked for me.
I'm trying to connect to a MySQL 5 database using the MySQL ODBC 5.1 driver. In the control panel's ODBC settings I created and tested the ODBC connection and it's working fine. When I try to use the connection from VBScript code I get an error though:
ADODB.Connection error '800a0ea9' Provider is not specified and there is no designated default provider.
I use the following code:
sConnection = "DSN=mydsn;"
Set objConn = CreateObject("ADODB.Connection")
objConn.Open(sConnection)
DSN-less (DRIVER={MySQL ODBC 5.1 Driver};) returns the same error.
Can you help me get this working, please?
Some things that might be the cause: The server is a Virtuozzo virtualized Windows 2003 server with IIS6 running as 64bit. I have installed the MyODBC 3.51 (x64) and MyODBC 5.1 (x86 and x64).
I found this to work from Windows to MySQL as a DSN-less connection. The trick was to ELIMINATE the port spec at the end of the server address.
"DRIVER={MySQL ODBC 5.3 UNICODE Driver}; Server=;Database=;User=;Password=; OPTION=3"
Note: Server string is the internet address of the server, BUT NO PORT SPECIFIED - ie, NO ":3306" on the end
I gave up on running IIS in 64bit mode - I followed advice found on some message board to reconfigure IIS to run in 32bit mode. After that ODBC still does not work, but now I can atleast connect dsn-less...
You might try
Provider=MySQLProv;DSN=mydsn;