I have a mysql database that I need to be imported into sql server via a linked server. Two of the mysql columns are blob and mediumblob. The columns in mssql are varbinary(max). When I execute a query at the linked server, I get the error:
OLE DB provider "STREAM" for linked server "(null)" returned message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
Msg 0, Level 11, State 0, Line 19
A severe error occurred on the current command. The results, if any, should be discarded.
The error goes away when I exclude the blob and medium blob columns from the select statement. Is there a conversion or workaround for this?
Related
I am trying to move data from SQL Server to MySQL using SSIS. I have used OLE DB Source for fetching data from SQL Server and ODBC Destination to push data into MySQL tables.
I have kept row by row insert method which is working fine without any error but it is very very slow.
When I tried Batch Insert method, the SSIS Package is failing with following error.
[ODBC Destination[191] Error: Open Database Connectivity (ODBC) error occured. State: 'HYC00' - Native Error Code:0 [MySQL] [ODBC 8.0(w) Driver] [mysqld-5.7.12] Parameter arrays with data at execution are not supported
There are 7 tables having 500 000 records each. It took around 9 hrs to complete using row by row method (no errors but very slow).
But when I choose batch, it is throwing the above error.
How to achieve batch insert for improving the data movement speed? I have installed ODBC 8.0 Driver.
Should I modify the connection string OR should I enable any pre-defined variable in MySQL OR what method can I try to achieve this.
I have an application which connects and stores data on a MySQL database, I need to connect and retrieve this data in a view from another application which uses an SQL Server Database. My attempt to handle this was to create a linked server that connects to the MySQL Server in SQL Server.
That seems to have worked, all connections have passed and if I run the following queries
SELECT * FROM MYSQLLINK...table1` or `SELECT * FROM OPENQUERY(MYSQLLINK, 'SELECT * FROM table1')
I get results.
Problem
The problem is, I want to create a view which joins quite a few reference tables ( I actually have 20 joins but it's joining the same table because it's a big reference table.)
but on execution on the SELECT or CREATE VIEW I get the following error.
OLE DB provider "MSDASQL" for linked server "MYSQLLINK" returned
message "[MySQL][ODBC 5.1 Driver]Lost connection to MySQL server at
'waiting for initial communication packet', system error: 10060".
Msg 7303, Level 16, State 1, Line 4
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQLLINK".
Completion time: 2020-01-19T22:00:00.1759949-04:00
I am unsure why this is occurring, would appreciate if any could assist in figuring this out and helping in mitigating this error that will allow my view to be created and queried.
I've noticed if I comment out 85% of the joins the query does not fail. Where would I increase this time out the tome that is mentioned?
I should also mention that the MySQL is on an AWS server while the SQL Server is on my localhost.
I couldn't recreate the failure test case on my local-end, but what you mentioned directs us to following pointers:
Your linked server connection is getting timeout (probably)
Potential reason for timeout could be the high response time of query (view which joins quite a few reference tables)
What about changing the approach:
Can you create the view on MySQL rather than on SQL Server?
Is materialization of the result of the view is an option?
Or alternatively, what about writing a stored procedure on SQL Server-end and sequentially join your tables one-at-a-time (or as-many-reasonable-at-a-time) with use of temporary tables to store intermediate results?
I'm trying to migrate a table from MySql to MSSQL using openquery but I keep getting the following error message:
OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "Requested conversion is not supported.".
Msg 7341, Level 16, State 2, Line 1
Cannot get the current row value of column "[MSDASQL].description" from OLE DB provider "MSDASQL" for linked server "MYSQL".
The SQL query I'm trying to run:
insert into dbo.tickets (id, description, createdAt)
select * from openquery(MYSQL, 'select * from mydb.tickets')
With openquery I have already copied a couple tables but this one tricks me.
On both side of databases the description field is varchar(8000). In MySql there is no row where description is null and the longest description is only 5031 characters.
I tried creating a new view in MySql with the same data structure but got the same error.
I can't determine which row has an invalid description field because the table contains more than 65000 rows.
I also tried dumping the data into an SQL file but I got OutOfMemoryException in Management Studio. The dumped sql file itself is about 60 MB.
Any suggestions or other ways of migrating this data?
Thanks in advance!
In my testing, I found that adding CAST(field as char(4000)) also solved the problem.
I created the following in a MySQL 5.1 database:
create table tmp_patrick (summary_text varchar(4096));
insert into tmp_patrick values ('foo');
When I executed the following on SQL Server 2008 R2 SP1 (10.50.2500), using MySQL ODBC driver 64-bit, either version 5.1 or 5.2w:
select * from openquery(MYSQL, 'select summary_text from scratch.tmp_patrick')
it generates the error:
OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "Requested conversion is not supported.".
Msg 7341, Level 16, State 2, Line 1
Cannot get the current row value of column "[MSDASQL].summary_text" from OLE DB provider "MSDASQL" for linked server "MYSQL".
but if I add CAST:
select * from openquery(MYSQL, 'select CAST(summary_text as char(4000)) from scratch.tmp_patrick')
then it works. Casting to char(4001) will fail.
It's not clear to me where the 4000 character limit comes from.
I managed to fix this issue by changing the datatype to TEXT at both MySql and MSSQL side.
I have a SQL statement running in SQL Server 2012 that sometimes works fine (returns a little over 4,000 rows in about 25 seconds) and sometimes fails after about 9 1/2 minutes with the error:
The OLE DB provider "MSDASQL" for linked server "Helpdesk" indicates
that either the object has no columns or the current user does not
have permissions on that object.
Here is the statement:
SELECT *
FROM OpenQuery(Helpdesk,
'SELECT ticketpostid,ticketid,dateline,userid,fullname,subject,editeddateline,contents,responsetime,staffid
FROM swticketposts
WHERE ticketpostid > 6609667'
)
Helpdesk is a Linked SQL that connects to a remotely located MySQL 5.5 server via an ODBC System DSN.
What are the possible causes of getting this error intermittently?
Running MSSQL Server 2008 Standard SP 2 64-bit on Win2K8. I have installed on this server the 64-bit MySQL ODBC driver version 5.1.8 from 10/28/2010. I have configured a DSN linking to a MySQL server 5.1 running on a Mac apple-darwin9.8.0 server (don't ask me, I inherited this). I have successfully created a linked server via MDSASQL to a specific MySQL database.
From the SQL Server box I can run simple queries of the nature
SELECT * FROM mysql_table WHERE id = 1;
However, it is painfully slow. A query as above takes 19 minutes and 52 seconds to execute; the same query takes 0.04 seconds when executed locally.
Further, I attempted to execute a simple update of the nature
UPDATE mysql_table SET field = 0 WHERE id = 1;
This ran for 2 hours before returning the following error:
OLE DB provider "MSDASQL" for linked server "LINKED_MYSQL" returned message "Out of memory.".
Msg 7399, Level 16, State 1, Line 3
The OLE DB provider "MSDASQL" for linked server "LINKED_MYSQL" reported an error. The provider ran out of memory.
Msg 7330, Level 16, State 2, Line 3
Cannot fetch a row from OLE DB provider "MSDASQL" for linked server "LINKED_MYSQL".
This comes on the heels of several failed jobs involving updates to the same table, all of which fail approximately two hours after they commence.
I have checked the permissions on the mysql and the user specified in the DSN has the appropriate permissions (well, all permissions) in mysql.user.
I would be most appreciative if anyone could give me any avenues to investigate to get this working.
Avoid joins to linked server tables and have a look at dynamic openqueries
And refer to this question that posted ealier.
Linked Server Performance and options