I'm getting the following error using Excel trying to add an external data source to the spreadsheet.
[Microsoft][ODBC Driver Manager]The specified DSN contains an architecture mismatch between the Driver and Application.
I can't find a compatibility chart between MySql and the MySql-ODBC Connector versions, but I got the latest that I could find. This is what I'm using:
mysql: 5.6.16 winx64
ConnectorODBC: 5.3.2x64
I've tried both the Ansi and Unicode versions of the driver. When adding it using the Windows Administrative Tools->Data Sources (ODBC) link the Test button says it connected successfully.
Data Source Name: Loans
TCP/IP server: localhost
Port: 3306
User:
Password:
Database: Loans
Thanks,
Ben
Your problem is that your client, Excel, is 32bit and needs to connect to a 32bit ODBC driver. Your 32bit ODBC driver will connect to a 64bit app just fine, what's important is that the client connects to a driver with the same architecture. On %windir%\syswow64 you'll find a file called odbcad32.exe, it's your 32bit ODBC control panel, add your 32bit MySQL ODBC driver there and use that to connect.
Related
I'm trying to import data from a MySQL Database to an Excel 365 (32 bit) Workbook.
This is a DB I can link to without any issues :
This is the DB I can't link to :
I've downloaded the following connector :
MySQL Connector Net 6.10.6
I suspect that this is not the correct connector for the second DB.
The error is this :
[MySQL: Unable to connect to any of the specified MySQL hosts.]
Could someone point me to the beginning of a solution ?
I've also tried to connect via VBA but I also get an error which must be due to the same causes as above.
If the database server and the database client (Excel) are running on different machines then they cannot communicate via UNIX filesystem sockets.
If you specify localhost as the target host in a libmysql client, then the client will try to connect via the (Unix) filesystem socket.
On the other hand, if you instead specify 127.0.0.1, it will use a TCP socket.
More Information:
Stack Overflow : How to connect to database when server is in Unix socket? (MySQL/PHP)
Wikipedia: Localhost
Wikipedia : Unix domain socket
Wikipedia : TCP Socket definition
MySQL.com : Configuring a Connector/ODBC DSN on Windows with the ODBC Data Source Administrator GUI
EDIT:
In response to your comment, the target host would be specified in the location specified on this page, or it can also be installed via command line with these steps.
Also you might find this helpful:
mysql.com : Using Connector/ODBC with Microsoft Word or Excel
mysql.com : Using Connector/ODBC with Microsoft Access
Setting up a MySQL ODBC DSN on Windows 7 64-bit:
I have a faint recollection of the last time I setup an ODBC DSN to MySQL.
It was a while ago so I might be mistaken on the details but I'm pretty sure that the only was I was able to get it working on a 64-bit system (possibly because the server was 32-bit?) was to install both the 32-bit and 64-bit drivers (from here) into separate folders, rebooting between each install. As I recall, it took a dozen install/uninstalls before I got it right.
Once it was properly installed, I had to administer it with Window's 32-bit version of ODBC Administrator.
There's 2 versions of ODBC Administrator (aka 'Data Sources'), confusingly:
My 64-bit version is located at : c:\windows\system32\odbcad32.exe
My 32-bit version is located at : c:\windows\SysWOW64\odbcad32.exe
Note that much of this is from memory and unverified!
I have this text file sitting in my "mySQL Notes" folder, so I gather I ended up using the command line to get it installed:
myodbc-installer -s -a -c1 -n " mysqlDSN " -t "DRIVER=MySQL ODBC 5.3 Unicode Driver;SERVER= (server name) ;DATABASE= (database name) ;UID= (user name) ;PWD= (password) "
In my case I was setting up connection to a web host server, so I referred to my CPanel for the server / database / uid values.
...and as I recall, I had to run it from the location of the 32-but version of the myodbc-installer. Also, you'll have an ODBC.INI text file somewhere showing the configuration.
More detail under the plethora of information here:
mysql.com : MySQL Connector/ODBC Developer Guide
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/
I am trying to connect to MySQL 5.6 on a Windows Server 2008 R2 localhost with pyodbc. I used the full installation for the MySQL instance on the localhost, including the ODBC connector. I have it connecting to a remote SQL Server instance beautifully, but for the life of me I can't get it to connect to the local MySQL instance. I am using this guide from connectionstrings.com as reference.
Here's some code:
import pyodbc
def create_mssql_conn():
return pyodbc.connect(r'Driver={SQL Server};Server=MSSQLSRV;Database=ecomm;Trusted_Connection=yes;')
def create_mysql_conn():
return pyodbc.connect(r'Provider=MSDASQL;Driver={MySQL ODBC 5.6 UNICODE Driver};Server=127.0.0.1;Database=ecomm;User=root;Password=myP#$$w0rd;Option=3;')
# conn = create_mssql_conn() # This one works
conn = create_mysql_conn() # This one breaks
cursor = conn.cursor()
cursor.execute('SELECT * FROM inventory')
while 1:
row = cursor.fetchone()
if not row:
break
print row
Here is the error:
pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
I tried everything from adding Provider=MSDASQL; to changing ANSI to UNICODE in the connection string. Any suggestions?
I was having a similar issue. I am using windows 8, and mysql.
The way I solved the problem was by going into my
control panel>Systems and Security>Administrative Tools.>ODBC Data Sources
Either the 32 bit or 64 bit version depending on your computer.
Then you click on the System DNS file. If you do not see any MySQL driver you have to click ADD. It brings up a list, from that list select the MySQL driver.
For me it was MySQL ODBC 5.3 ANSI(they have a unicode driver also). Click finish. Once you do that then you have to change your connection line in your code to the corresponding Driver that you just filled out.
Ex:
def create_mysql_conn():
return pyodbc.connect(r'Driver={MySQL ODBC 5.3 ANSI Driver};Server=MSSQLSRV;Database=ecomm;Trusted_Connection=yes;')
This should work, or at least it solved my connection issue because I was getting all sorts of different errors with everything I tried. This was what solved the issue for me.
In Win64 there are two ODBC environments: 32 and 64 bit and you can work with Python 32 bit or Python 64 bit. Check what version of Python you use and then use proper version of odbcad32.exe (32 bit version is located in the SysWoW64 directory) to create SystemDSN. With SystemDSN you can check if you can connect to the database. Then try to connect to DB from Python code.
You can list ODBC datasources available to pyodbc via my code recipe: https://code.activestate.com/recipes/578815-printing-list-of-odbc-data-sources-with-pyodbc-mod/
Head to Administrative Tools and the ODBC Data Sources. You should click on the DNS file. Most likely you'd see Microsoft Access and excel as the only data sources available, so you need to add your SQL Server. Mine was SQL Server 2008 R2, and so far, it has worked.
For the error mentioned
"pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')"
I installed the 'Microsoft Access Database Engine 2010 Redistributable 64-bit' as I have 64-bit system and then added the DSN in the directory of MS Access database and it's working now.
Here is the link of the video for how to create DSN and connect to python.
https://www.youtube.com/watch?v=zw9P2wSnoIo
I am attempting to connect R to a MySQL database via RODBC (in Win 7 environment), but cannot get past the following error:
[RODBC] ERROR: state IM014, code 0, message [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
After entering the following command:
odbcConnect(dsn,uid="My_UID",pwd="My_PWD")
I have successfully created a driver for the database by following the odbc wizard, and have installed the RODBC package into RStudio (ver 0.98.490). The MySQL is running on 32bit, I have the 32bit driver installed and working, and my RStudio is also 32bit. I know that the driver is working since both the test connection in config. works, as do queries run on excel using the driver.
What can I do to get the connection to work in R?
(Previous responses to this question seem to have been removed.)
Thanks in advance!
I faced a similar RODBC connectivity issue using DSN, where R was crashing abruptly without any logs/error trace. I tried with DSN-less ODBC connection API, it works fine.
odbcDriverConnect("SERVERNAME=;DRIVER={};DATABASE=;UID=;PWD=;")
Steps:
1. Install ODBC driver
2. Define VNode (host, listen address, protocol)
3. Use the odbcDriverConnect API
Docs:
http://cran.r-project.org/web/packages/RODBC/RODBC.pdf
http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf
Hope this helps.
Somehow I'm having a lot of trouble establishing an ODBC connection to MySQL from within MSSQL Management Studio. I have 64-bit versions of MSSQL and MySQL ODBC connector installed.
The local MySQL database already has a DSN assigned to it. I've used this DSN with Excel in the past and had no problems.
Now, (in SQL Man. Studio) when I access:
'Tasks' -> 'Import Data' -> '.Net Framework Provider for ODBC'
I get a helpful form asking me to enter all the connection details even though I've already registed the DSN in 'Control Panel\Data Sources'.
So, after a brief 'wait, what?", I enter:
Dsn: My_Dsn
Driver: MySQL ODBC 5.2 ANSI Driver
... and get: ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
#
PS.
I've also tried creating a linked MySQL server in MS Studio like so: http://www.sqlservercentral.com/Forums/Topic340912-146-1.aspx
and get:
'contains no columns that can be selected or the current user
does not have permissions on that object.'
In short: no access to MySQL from within MSSQL Studio whatsoever
Thanks in advance!