How to connect from MSSQL server running on ubuntu to MySQL? - mysql

I'm trying to connect to a MySQL server instance, using a distributed query, with the folling query:
SELECT *
FROM openrowset('SQLNCLI11','server=<>,33333;uid=root;pwd=<>','SELECT * FROM mov.users')
I get the following errors:
OLE DB provider "SQLNCLI11" for linked server "(null)" returned message "Client unable to establish connection due to prelogin failure".
OLE DB provider "SQLNCLI11" for linked server "(null)" returned message "Protocol error in TDS stream".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "(null)".
I've tried using SSL on my MSSQL instances and nothing. I've ran the execute command for the sp_configure to enable 'ad hoc distributed queries', and nothing. I've tried to create a linked server but it doesn't seem to be a mssql on linux compatible feature.
How can I cestablish a direct connection between a MSSQL running on linux to a MySQL server?

On Linux, SQL Server does not support Linked Servers to data sources other than SQL Server. See unsupported features

Related

Distributed Transaction on Linked Server between sql server and mysql

I have a table say Table1 on SQL Server 2014 and MySQL both.
Table1
ID INT,Code VARCHAR(100)
I created a linked server MyLinkedServer in SQL Server using "Microsoft OLEDB Provider for ODBC".
**Linked Server **
EXEC master.dbo.sp_addlinkedserver #server = N'MyLinkedServer', #srvproduct=N'MyLinkedServer', #provider=N'MSDASQL', #datasrc=N'MyLinkedServer'
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=N'MyLinkedServer',#useself=N'False',#locallogin=NULL,#rmtuser=N'username',#rmtpassword='########'
Linked Server Settings
EXEC master.dbo.sp_serveroption #server=N'MyLinkedServer', #optname=N'data access', #optvalue=N'true'
EXEC master.dbo.sp_serveroption #server=N'MyLinkedServer', #optname=N'use remote collation', #optvalue=N'true'
EXEC master.dbo.sp_serveroption #server=N'MyLinkedServer', #optname=N'remote proc transaction promotion', #optvalue=N'true'
The linked server is created successfully and I am able to query Mysql Table in SQL Server.
Query
When I run
INSERT INTO MyLinkedServer...Table1(ID,Code) SELECT 1,'Code1'
The record is inserted. However when I start a transaction and run the INSERT, I get an error:
BEGIN TRAN
INSERT INTO MyLinkedServer...Table1(ID,Code) SELECT 1,'Code1'
COMMIT
Error:
OLE DB provider "MSDASQL" for linked server "MyLinkedServer" returned message "[MySQL][ODBC 5.3(a) Driver]Optional feature not supported".
Msg 7391, Level 16, State 2, Line 8
The operation could not be performed because OLE DB provider "MSDASQL" for linked server "MyLinkedServer" was unable to begin a distributed transaction.
What I have tried so far.
Enable XA Transactions in MSDTC
Enabled following setting in Linked Server Provider
Nested queries
Level zero only
Allow inprocess
Supports ‘Like’ Operator
I checked the following links and their suggestions however the error persists:
Distributed transactions between MySQL and MSSQL
SQL-Server and MySQL interoperability?
SQL Server and MySQL Syncing
EDIT
Additional Details:
MySQL is using InnoDB storage engine on Ubuntu machine.
I have already configured the ODBC connector and used it to configure a ODBC System Data Source which is used in the Linked Server
Theoretically this should work.
I would suggest different steps to sort this out:
Have you checked you MySql storage engine yet? It looks only InnoDB storage engine support distribute transaction per MySql document: https://dev.mysql.com/doc/refman/5.7/en/xa.html
See if you can switch to use MySQL Connectors setup connection to connect to MySql in SQL Server instead of OLEDB provider, which state by MySql document above that support distribute transaction.
If still not working, it might be the MSDTC service itself has some problem, see if you can isolate that like get a SQL Server instance running on the MySql server box(if you are using Windows MySql), or try install Windows MySql on the Sql Server box to get distribute transaction working between two MySql. Which would be able to point you to the actual problem.
EDIT:
Unfortunately it looks that you proved this not working, I've a closer look at the MySql document and sorry it looks that I wasn't reading it thoroughly, it says:
Currently, among the MySQL Connectors, MySQL Connector/J 5.0.0 and higher supports XA directly
And by some other Googling I found this: https://bugs.mysql.com/bug.php?id=37283, people report this bug many years ago and they marked this as a won't fix.
Some one suggested something here: https://social.msdn.microsoft.com/Forums/en-US/fc07937d-8b42-43da-8c75-3a4966ab95f9/xa-msdtc?forum=windowstransactionsprogramming, which is to implement your own XA-Compliant Resource Managers to be used by your application (https://msdn.microsoft.com/en-us/library/ms684317.aspx)
As on SQL 2014, you could have configured the linked server not to enlist in a distributed transaction. Although you could try adding "Enlist=false" in the #provstr argument to sp_addlinkedserver

Linked servers - SQL2008 to MySql - error: 7303 - Data source

Problem:
I use SQL Server 2008.
We have here a linked server, linking to a MySql Database.
But since today, when I click "test connection", it shows me this error:
( I can't post images yet):
The test connection to the linked server failed.
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MANTIS".
OLE DB provider "MSDASQL" for linked server "MANTIS" returned message "[Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified". (Microsoft SQL Server,
Error: 7303)
What should I do?
It was working yesterday. I thought about "data sources ( ODBC)". Yes, There is no DataSources for MySql ( it doesn't even show me the option to add a mySql odbc when I click ADD), but it was working yesterday !!
I didn't find a reasonable solution from any post.
answer, taken from the question
Restart server + Install MYSQL ODBC DRIVER 51 ( MySql connector )
Start - control panel > Administrative Tools > Data Sources (ODBC) > System DSN > ADD
MySql ODBC 501 Driver

Error during deploy from visual studio to analysis server

I'm connected to analysis server:localhost\sqlr2.
I'm using windows authentication,so user name and password are all grayed out.
I'm trying to deploy a project from Visual Studio BI to SQL Server 2008R2 analysis server and get the following errors:
Error 1 Internal error: The operation terminated unsuccessfully. 0 0
Error 2 OLE DB error: OLE DB or ODBC error: Login timeout expired; HYT00; A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.; 08001; Named Pipes Provider: Could not open a connection to SQL Server [53]. ; 08001. 0 0
Error 3 Errors in the high-level relational engine. A connection could not be made to the data source with the DataSourceID of 'Max Min Manufacturing DM', Name of 'Max Min Manufacturing DM'. 0 0
It looks like your datasource is set up wrong. When you process, what server is the cube pointed at? What account does SSAS run under? How have you set up the connection string in the datasource? Are you seeing failed login attempts in the SQL Server logs?
Error 2 OLE DB error: OLE DB or ODBC error: Login timeout expired; HYT00;
A network-related or instance-specific error has occurred while establishing a
connection to SQL Server. Server is not found or not accessible.
Check if instance name is correct and if SQL Server is configured
to allow remote connections.
I'd focus on this. I assume you must be able to connect to SQL Server in Visual Studio to build your cube, so I guess Analysis Services doesn't have permissions. Check your connection strings.
You say you're using Windows Authentication, so does the service accounts that Analysis Services runs under have access to the required database?
I would like to share my experience with this error and how I discovered the solution.
Hope it helps!
http://afsawaf.blogspot.com/2013/08/ole-db-error-ole-db-or-odbc-error.html
---Thanks #kleopatra for the advice.
In my case I was connecting with a wrong provider, I was trying to connect using SQL Server Native Client 11.0 to MS SQL Server 2005 DB which caused my similar problem.
When I reverted to version 10.0, worked perfectly!

Cannot connect to SQL Azure using SQL Server Management Studio

I have create a SQL Azure database on the Azure portal, now I want to connect to it using SQL Server Management Studio. I've set my properties like this:
Server Type:Database Engine:
Server Name:[mycred].database.windows.net
Authentification: SQL Server Authentification
username: myusername
password: mypassword
But when I try to connecting with these properties I get an error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Microsoft SQL Server, Error: 53)
Whereas I have configure firewall on my SQL Azure database. How to solve this issue?
Your request has not left your machine that's why it is returning network error. There could be several issues and first start with SQL Server Management Studio. You must have SSMS R2 2008. Any non R2 version will not work.
Here is a list of test you would need to perform to troubleshoot the problem and apply solution:
http://social.technet.microsoft.com/wiki/contents/articles/sql-azure-connectivity-troubleshooting-guide.aspx

Advantage to SQL 2008 Linked Server Access Denied Error

I am trying to create a linked server in SQL 2008 to an Advantage v7 database server. I've successfully created the linked server in SQL 2008 using the commands below and the connection tests out fine. Also, the Advantage DB I'm connecting to does not have a data dictionary.
SQL to create the Linked Server
EXEC master.dbo.sp_addlinkedserver
#server = N'ADVANTAGE', #srvproduct=N'Advantage',
#provider=N'Advantage.OLEDB',
#datasrc=N'\\asc1\questtest$\spaulrun'
/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin
#rmtsrvname=N'ADVANTAGE',
#useself=N'False',
#locallogin=NULL,#rmtuser=NULL,#rmtpassword=NULL
When I run the following query:
select * from
openquery(ADVANTAGE,'select * from members')
I get this error:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Advantage.OLEDB" for linked server "ADVANTAGE" reported an error. Access denied.
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Advantage.OLEDB" for linked server "ADVANTAGE".
I've verified that this is not an NT File permissions issue. Also, just before the error messages are displayed, I can see all of the column names on the screen for just a second. So I'm getting at least some table information back from Advantage. I just don't know why I'm getting the Access denied message.
Any help is greatly appreciated!
This sounds familiar, but I don't remember the exact error message I got.
Try going to the Advantage OLE DB Provider in the Linked Server setup and right click and choose properties and set "Allow Inprocess".
If I remember correctly, in Management Studio Express i went to
Server Objects -> Linked Servers -> Providers -> Advantage OLE DB Provider (Right Click->Properties or Double Click)
Set "Allow Inprocess"