Unable to add MYSQL System DSN on ODBC 64bit - mysql

I am trying to add new MYSQL system DSN with no luck. There are no errors. After adding in the details and when i click OK it completes with no error but i do not see it in the list of DSN.
MYSQL connector driver version 8.0.21 x64bit has been installed. I am able to create other DSN (sql server, access, excel etc..) just not MYSQL.
Any help would be greatly appreciated.
Thanks.

I was using '.' in the Name and that was causing issue. Turns out there are some special chars that are not supported in the DataSource Name when setting up ODBC connection. :|

Related

MySQL->ODBC->Excel: DataSource.Error: You have an error in your SQL syntax;

I've built a pretty basic database using MySQL Workbench - and I've uploaded a bunch of data. Now I am trying to pull data from my database into MS Excel using an ODBC connection via Excel's Get Data. However, after setting up the ODBC connection, I'm getting the following error for ALL my data fields/columns:
DataSource.Error: ODBC: ERROR [42000] [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.26]You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '.columns_priv' at line 8 Details:
DataSourceKind=Odbc
DataSourcePath=dsn=MySQL Local
OdbcErrors=[Table]
I've searched all over for ideas - I've even tried adding text: SET sql_mode='ANSI_QUOTES' into the Initial Statement field in the Details option in the ODBC connector, as I thought it could be quotes related?
My versions:
MySQL Workbench 8.0.26,
MySQL Connector/ODBC 8.0.26,
MS Excel 2019
Can anyone see where I'm going wrong, or how I can fix this?
Any help would be most appreciated. Thanks,
Stevie
i tested it with my mysql 8.0.26
i used
MySQL ODBC UNICODE driver
My Server is configured to run in legacy mode on local host, but when youz can conect via Workbench, you can use tcpip and localhost
The steps are
Connecting Excel to MySQL with Data Connection Wizard (Legacy Wizard)
Start a new worksheet
Go to the Data tab.
Click From Other Sources, and then click From Data Connection Wizard.
In the opened dialog, you select ODBC DSN and click Next to continue.
Now select a data source you want to connect to, and click Next.
To connect to the table containing the wanted data, select its name and click Next to enter and save information about your new file or click Finish.
In the Import data dialog, you can select the way your data will be viewed in Excel and the place where to put it in the worksheet, and click OK.
The selected data are displayed in the prior empty Excel worksheet.
Good morning.
Have the same issue since updating mysql and mysql odbc to 8.0.26.
mysqld on centos and odbc on windows 10.
Working fine on 8.0.25
Thinking on rollback.
You all have a nice day
I got the same problem. I changed ODBC 8.0 Unicode Driver to 5.3 version. Problem solved.
Same issue.
According to the error log, the odbc adds a nonsense pair of backquotes between the database name and table name in the "select ... from ..." sql.
Downgrade my mysql odbc version to 8.0.25.
Problem solved.

Linking MySQL to MS SQL Server using OBDC Drivers (Error 7303)

I am trying to make a link between MySQL and MSSQL databases using ODBC Drivers. The reason is that our website is built using PHP and MySQL and we need to manage the database from SQL Server Manag. Studio.
I have already linked MySQL to MS ACCESS, so MySQL ODBC drivers are fully working.
When I try to link them from MICROSOFT SQL SERVER MANAGEMENT STUDIO > SERVER OBJECTS > LINKED SERVERS > NEW LINKED SERVER...
With this configuration:
I get this error:
I have tried with all these versions of MySQL OBDC Drivers:
ODBC 5.3 Unicode (32-bit) - This one is the one working with MS ACCESS
ODBC 5.3 ANSI (32-bit)
ODBC 5.3 Unicode (64-bit)
ODBC 5.3 ANSI (64-bit)
ODBC 8.0 Unicode (64-bit)
ODBC 8.0 ANSI (64-bit)
For the NEW LINKED SERVER:
I have tried writing this in "Provider string":
Driver={MySQL ODBC 5.3 ANSI Driver};
DATABASE=myDB;OPTION=134217728;PWD=myPASS;UID=myUSER;SERVER=mySERVER
ODBC:DSN=KARALIGROUP32::Table=myTABLE
I have also tried writing myTABLE in "Catalog".
For the Security tab, I have tried all four options given. (In the last option, I typed the login for MySQL DB and also for SQL Server)
For the Server Options tab, I have tried given RPC and RPC out (both in TRUE or both in FALSE)
I also have to mention that the database SQL Server is not my own one, so I don't have full credentials. This is my user's permissions from SECURITY > LOGINS.
My conclusion: I think it is about MS SQL SERVER MANAGEMENT STUDIO configuration or my permissions as the user.
Thanks for your help!
Update:
I have followed the advise given by TallTed, it didn't work as yet.
In the Security and Server Options tabs, I have left them as shown in the previous screenshots.
I have also tried all the ODBC connections shown in the screenshot.
Any other ideas? Thanks for your help!
First off -- the error you've shown has nothing to do with your SQL Server user permissions.
Next -- it's important to remember that Microsoft SQL Server isn't really an ODBC client application. It is an OLE DB and an ADO.NET client application.
Also note -- 64-bit SQL Server requires a 64-bit ODBC driver; 32-bit SQL Server requires a 32-bit ODBC driver. There are some extra gotchas with 64-bit SQL Server, as described in this article on my employer's site.
If your data is strictly 8-bit "narrow" codepages, then you do not need a Unicode driver, and will probably find it easier to work with the ANSI driver. That said, given that you have ODBC 5.3 Unicode (32-bit) working with Access, I would think you'll have success using that or ODBC 5.3 Unicode (64-bit) with SQL Server.
Now -- a possible step toward success.
In your first screenshot, Product Name must be MSDASQL. You will need no Provider String, because this string comes from your ODBC DSN.
I solved it!
I was using a client computer. I installed the driver in the server and then followed this post: https://www.mssqltips.com/sqlservertip/4570/access-mysql-data-from-sql-server-via-a-linked-server/
Thanks and I hope it would help someone!

Errors occur when set MySQL ODBC

Errors occur when set MySQL ODBC.
My operating system is win10 x64 and my MySQL Server version is 5.5. My Connector ODBC version is 5.3.
When I establish OBDC, the connection test is successfully, just as the following image.
However, when I click the "OK" button, there comes an error. The DSN is invalid.
I have refered some websites and tutorials, but still can not solve the problem.
Do not name your Datasource ODBC. Try Foobar, or abc, it should work. For whatever reason, the string ODBC cannot be used as DSN. This does not depend on the driver used.

pyodbc + MySQL + Windows: Data source name not found and no default driver specified

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

Excel MySQL Connector/ODBC

I'm trying to make a connection to MySQL using Excel. I'm successfully able to connect via Oracle SQL developer, but i'm having trouble connecting via Excel using same credentials.
I've installed 'mysql-connector-odbc-5.2.5-winx64.msi' on my machine. Then i try to make a 'Data Source (ODBC)' connection from control panel. Then i click on Add > MySQL ODBC 5.2 Unicode Driver > Data Source Configuration Tab. On this tab i've entered everything except 'Named Pipe'. Not sure what this is. Also, i've entered all same credentials from Oracle SQL Developer, except 'Service Name'. Not sure where to enter this.
Any help would be appreciated.
Where is your server located? Why not use TCP/IP?
Named pipes is for SQL Server and within the physical (virtual) machine. Not between peers (client and host).