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
Related
I was following the instructions for registering a driver and data source given here: "Installing Connector/ODBC from a Binary Tarball Distribution"
After realizing I had to use sudo when running myodbc-installer, I could successfully get the driver I installed to show as registered, with:
shell> myodbc-installer -d -l
MySQL ODBC 8.0 Driver
When you run myodbc-installer with no arguments, it lists the command line switches and also tells you how to register a data source. The example it gives is:
Add a new system data source name for Unicode driver
shell> myodbc-installer -s -a -c2 -n "test" \
-t "DRIVER=MySQL ODBC 8.0 Unicode Driver;SERVER=localhost;DATABASE=test;UID=myid;PWD=mypwd"
That didn't exactly match the name (it's MySQL ODBC 8.0 Driver, not MySQL ODBC 8.0 Unicode Driver... the ASCII driver is merely MySQL ODBC 8.0 😒)
But using the appropriate driver name, I managed to get the installer to successfully register a data source, which could be listed back:
shell> myodbc-installer -s -l
test - MySQL ODBC 8.0 Driver
But the program I tried to use this DSN with wasn't working. So I thought I would look for some simpler case to try. The iodbctest program seemed like a good candidate, as it has a function where you hit ? and it lists the data sources. But I don't get anything...
shell> iodbctest
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0812.0326
Enter ODBC connect string (? shows list): ?
DSN | Driver
------------------------------------------------------------------------------
Enter ODBC connect string (? shows list):
Since sudo helped with the installation process, I thought I'd try sudo iodbctest, but that did not help.
So I thought I would look for some simpler case to try. The iodbctest program seemed like a good candidate, as it has a function where you hit ? and it lists the data sources.
Don't mix installs of iodbc and unixodbc. iodbc isn't an abstract set of tools and tests for ODBC, it is a completely independent implementation of ODBC from unixodbc.
In my case, I first installed unixodbc. So that's what myodbc-installer asked to register the drivers and data sources, via shared library functions. But it wrote the .INI files in a way that doesn't match what iodbc would have written.
Case in point: the iodbctest client appears to not be dynamically linked to use whatever ODBC provider is on your system. It is statically linked to iodbc routines that look explicitly in the odbc.ini file for an [ODBC Data Sources] section. This index does not appear to be made automatically by the unixodbc registration process.
(Note: This may be a bug in either unixodbc or mysql-installer's usage of it, as the documentation says "An [ODBC Data Sources] section is maintained in each odbc.ini and may or may not be used by the odbcinst library.")
Interestingly, while the mysql-installer tells you how to use it to register a data source, a different suggestion on the MySQL website tells you to edit the INI file by hand. This contradicts what unixodbc says, which is "NOTE: odbc.ini and odbcinst.ini are considered to be ODBC System Information. All access (read or write) to this System Information should occur via the Driver Manager or the ODBCINST share library. Do not access these INI files directly!" (emphasis theirs)
Beyond the issue of not being able to get the index, even if you do connect to a data source on Linux, iODBC uses wchar_t and not SQLWCHAR. So with a unicode driver, you'll get a bunch of gibberish back from your queries.
Since I don't like reading long questions myself I'll make it quick and dirty:
Starting Point:
MySQL DB on Server
Win10 machine with Excel (Office 365)
ODBC Driver installed
Test with ODBC connector works fine:
Goal:
Connecting from Excel to the DB via ODBC
Problem:
When choosing the DSN, the following error appears:
!BUT! I can connect from other workstations just fine (same setup/credentials).
Checklist:
IP from this (and other workstations) are allowed on the server (and are correct)
Excel and drivers are all 32 bit (checked on excel 64 with correct driver, same problem)
Since the connection test is successful, the login credentials are obviously correct
Steps taken in excel:
open Excel
choose ODBC:
choose saved (and tested) connection and press "ok":
No further steps are taken within excel.
What else could I check? What am I missing here?
The error message shows that MySQL is receiving esa as the username. Double-check that your DSN does not have the wrong username value saved.
I'm guessing that your Windows, Excel, and intended ODBC driver are all 64-bit.
You might have a 32-bit User DSN that's getting in the way of a 64-bit User DSN; best to only use System DSNs on 64-bit Windows, as discussed here. Be sure to use both 32-bit and 64-bit ODBC Administrators (C:\Windows\SysWoW64\odbcad32.exe and C:\Windows\System32\odbcad32.exe, respectively) to check.
I'm currently trying to run a classic ASP application which I've been given source code for. I want to set up on my 64bit Windows 7 dev machine and am having trouble with an ODBC based data connection to a MySQL instance.
I'm seeing the error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
/includes/<File Name>.asp, line 100
What I've tried:
The connection is DSN-less.
The application is running under IIS app pool with local system permissions. w3wp.exe can be seen running under NT AUTHORITY/SYSTEM in process monitor.
The application is running under IIS app pool with 32 bit applications allowed to run.
Have tried with Connector/ODBC 5.1.10 64 bit version only installed from http://dev.mysql.com (At this point no driver was listed under C:\Windows\SysWOW64\odbcad32.exe but was under C:\Windows\system32\odbcad32.exe)
Have tried with Connector/ODBC 5.1.10 32 bit version only installed from http://dev.mysql.com (At this point no driver was listed under C:\Windows\system32\odbcad32.exe but was under C:\Windows\SysWOW64\odbcad32.exe)
Have tried with Connector/ODBC 5.1.10 32 bit and 64 bit versions installed.
Verified driver name is not misspelled. Along with other checks from here http://support.microsoft.com/kb/306345.
Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=DBName;User=root;Password=Password;Option=3
Additional Information:
I'm monitoring in process monitor, and the two results are:
PATH NOT FOUND (Looking for .asp/web.config which seems odd.
BUFFER OVERFLOW
Both entries show:
User: NT AUTHORITY\SYSTEM
Process:
C:\Windows\SysWOW64\inetsrv\w3wp.exe
C:\Windows\SysWOW64\odbcint.dll
I'm stumped can any one make a suggestion on how I get this running in the context I have described?
Solved the problem now. Recording here in case this of use to others.
The issue was much simpler than it first appeared. The problem was that the application used a mixture of named and unnamed datasources (DSN / DSN-Less).
It was not apparent to me that any named connections were used until I set up the application for debugging in Visual studio. Here is a rough guide to debugging the application in visual studio (Except I used HTTP based website, rather than file system):
http://www.codeproject.com/Articles/28792/Debugging-Classic-ASP-VBScript-in-Visual-Studio-20
Following creating the required DSN, there were some further exceptions being thrown regarding default values in database columns. This was due to a MySQL setting that can be changed in the my.ini file.
http://bugs.mysql.com/bug.php?id=14306
C:\Program Files (x86)\MySQL\MySQL Server 5.5\my.ini
# Set the SQL mode to strict
# sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql-mode=""
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 have a MySQL instance running on a Linux box, and a Mac which also has Win7 (Bootcamp/VMWare). I can connect to the MySQL db from Navcat Lite for Mac with no problems, however, I prefer Toad. I installed Toad for MySQL for Win7 but it just CANNOT connect to the db. I installed ODBC for MySQL and it CAN successfully connect to the db, so it's not a firewall issue (I also tried disabling the firewall)
Here is a quick summary of what I see:
MySQL db running on Linux box, within my network, port 3306
Mac can successfully connect to the db through Navcat Lite
Toad for MySQL (Win 7) CANNOT connect to the db using a TCP connection (tried increasing connection timeout to 30 sec)
ODBC Driver for MySQL (Win 7) CAN connect to the db using the same credentials
Any help would be much appreciated!
Here is the error that Toad throws:
System.TimeoutException
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Check this bug report. Might be what you are facing.
link:
http://toadformysql.com/thread.jspa?threadID=32380
Taking in account your recent outcome from the packet sniffing, i do believe it is related to this bug report.
Toad seems to use the .net framework, according to the release notes it requires version 3.5 to be installed and the security policy set to unrestricted.
So, do you have .net 3.5 installed? if so, can you try to run toad as administrator?
PS: to set the security policy and i'm quoting from the link above:
To run Toad, the .NET security policy must be set to Unrestricted. To modify the security policy:
Select Control Panel from the Windows Start menu.
Double-click Administrative Tools.
Double-click Microsoft .NET Framework version Configuration.
Select My Computer, and then select the Runtime Security Policy
node.
Select Evaluate Assembly from the list of tasks in the right panel,
and locate and select Toad.exe in the File field.
Click Next and set the permission to Unrestricted.
Hope it helps, keep providing information.
I have the same issue with one my MySQL installations. I am able to connect using MySQL Workbench, but Toad for MySQL does not connect. Also, every application I created using MySQL .NET Connector also times out.
The solution I found was to connect the machines to the Internet and they connect instantly. I believe it has to do with the Connector and not Toad. Updating to a version beyond 5 should help.
Using freeware Toad for MySQL 8.0.0.296 (64 bit), instead using connection type TCP, use connection type SSH, insert database data like Host IP, user, password, default database and port. Also add SSH port, SSH Host IP, SSH user and password. Toad will emulate onnection directly to SSH console, the interface is the same, it works very fine, the error "Character set 'utf8mb3' is not supported by .Net Framework" is gone.
I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases.
Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL databases.
Under Tools > Preferences > Databases there is a third party JDBC driver path that must be setup. Once the driver path is setup a separate 'MySQL' tab should appear on the New Connections dialog.
Note: This is the same jdbc connector that is available as a JAR download from the MySQL website.
In fact you should do both :
Add driver
Download driver https://maven.atlassian.com/content/groups/public/mysql/mysql-connector-java/5.1.29/
To add this driver :
In Oracle SQL Developper > Tools > Preferences... > Database > Third Party JDBC Drivers > Add Entry...
Select previously downloaded mysql connector jar file.
Add Oracle SQL developper connector
In Oracle SQL Developper > Help > Check for updates > Next
Check All > Next
Filter on "mysql"
Check All > Finish
Next time you will add a connection, MySQL new tab is available !
Here's another extremely detailed walkthrough that also shows you the entire process, including what values to put in the connection dialogue after the JDBC driver is installed: http://rpbouman.blogspot.com/2007/01/oracle-sql-developer-11-supports-mysql.html
My experience with windows client and linux/mysql server:
When sqldev is used in a windows client and mysql is installed in a linux server meaning, sqldev network access to mysql.
Assuming mysql is already up and running and the databases to be accessed are up and functional:
• Ensure the version of sqldev (32 or 64). If 64 and to avoid dealing with path access copy a valid 64 version of msvcr100.dll into directory ~\sqldeveloper\jdev\bin.
a. Open the file msvcr100.dll in notepad and search for first occurrence of “PE “
i. “PE d” it is 64.
ii. “PE L” it is 32.
b. Note: if sqldev is 64 and msvcr100.dll is 32, the application gets stuck at startup.
• For sqldev to work with mysql there is need of the JDBC jar driver. Download it from mysql site.
a. Driver name = mysql-connector-java-x.x.xx
b. Copy it into someplace related to your sqldeveloper directory.
c. Set it up in menu sqldev Tools/Preferences/Database/Third Party JDBC Driver (add entry)
• In Linux/mysql server change file /etc/mysql/mysql.conf.d/mysqld.cnf
look for
bind-address = 127.0.0.1 (this linux localhost)
and change to
bind-address = xxx.xxx.xxx.xxx (this linux server real IP or machine name if DNS is up)
• Enter to linux mysql and grant needed access for example
# mysql –u root -p
GRANT ALL ON . to root#'yourWindowsClientComputerName' IDENTIFIED BY 'mysqlPasswd';
flush privileges;
restart mysql - sudo /etc/init.d/mysql restart
• Start sqldev and create a new connection
a. user = root
b. pass = (your mysql pass)
c. Choose MySql tab
i. Hostname = the linux IP hostname
ii. Port = 3306 (default for mysql)
iii. Choose Database = (from pull down the mysql database you want to use)
iv. save and connect
That is all I had to do in my case.
Thank you,
Ale
Although #BrianHart 's answer is correct, if you are connecting from a remote host, you'll also need to allow remote hosts to connect to the MySQL/MariaDB database.
My article describes the full instructions to connect to a MySQL/MariaDB database in Oracle SQL Developer:
https://alvinbunk.wordpress.com/2017/06/29/using-oracle-sql-developer-to-connect-to-mysqlmariadb-databases/
You may find the following relevant as well:
Oracle SQL Developer connection to Microsoft SQL Server
In my case I had to place the ntlmauth.dll in the sql-developer application directory itself (i.e. sql-developer\jdk\jre\bin). Why this location over the system jre/bin I have no idea. But it worked.