 |
|
 |
Hi, I have followed your code but when I tried to get the data from mysql to SQL Server using this query
SELECT * INTO gbdbMS.dbo.shoutbox FROM openquery(MYSQL, 'SELECT * FROM gbdb.shoutbox')
I got the following error message
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQL".
What could be the problem?
Thank you for your time and effort.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, I have managed to solve the problem by using more updated ODBC driver 5.1 instead of the 3.1 that I had before.
However, I am facing another problem, the data that I am importing from mysql is in Arabic character encoded in UTF8. When I used your query and imported this data into Sql Server, the data is displayed in a funny way that doesn't make any sense. I have changed the collation on the table and the column to Arabic but still no luck.
Any suggestion from your part about how to solve this problem? This is a business data and I cannot afford re-enter it.
Thank you for your time and effort
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Your problem is generic for the Arabic characters. UTF8 encoding should support the migration. I have no clue but suggest you upgrade your mySQL database to higher version and then try with the migration from the beginning. Tell me if that works.
Best regards,
Niklas Henricson
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
I am trying to create a linked server between MySQL and MS SQL Server so that the same database can be replicated at both the servers. I am initially testing the linked server with both the servers being on the localhost. Later i would migrate to different server locations.
I performed the instructions as mentioned. The creation of the linked server was easy. When i tried to copy one of the tables from MySQL to MS SQL Server, i am getting the following error.
OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[MySQL][ODBC 5.1 Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 0". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQL".
I am running this on an x64 machine with windows XP SP 2.
I have rechecked all the properties. Enabled OLE Automation in SQL Server 2005 Surface Area Configuration. Restarted the MySQL Server. Nothing has helped yet.
Kindly suggest what can be the issue and possible solution.
Thank You, Soumen
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi Niklas Henricson,
Thank you for getting back to my question. I tried what was mentioned in that bug report. Firstly i didn't find a bind-address value at
C:\Program Files\MySQL\MySQL Server 5.1\my.ini.
I used these 2 values for the bind-address under the section [mysqld]
bind-address=127.0.0.1 bind-address=localhost
I still am getting the following errors while trying to run a simple openquery...
SELECT * INTO dbName.dbo.tableName FROM openquery(MYSQL, 'SELECT * FROM dbNameMySQL.tableNameMySQL')
------ERROR------ OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[MySQL][ODBC 5.1 Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 0". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQL". ------ERROR------
Also when i try to check the properties of the Linked server in MS SQL Server. Was basically trying to check if there are any issues while mapping the user login between the servers. Here are the following errors found...
------ERROR------ "The linked server has been updated but failed a connection test. Do you want to edit the linked server properties?" ------ERROR------ An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo) ------ERROR------ Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQL". OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[MySQL][ODBC 5.1 Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 0". (.Net SqlClient Data Provider) ------ERROR------
Would re-installing or changing certain passed in values in MySQL help? Kindly suggest what can be a work around.
Thank You Soumen
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Niklas Henricson,
I wanted to update the status of creating the linked server. I was able to successfully configure a MS SQL Server and MySQL server linked server connection on a different 32 bit machine. Both the servers are local and i tried the same steps that you had mentioned. Its strange though that the linked server was giving me problems on my x64 machine on which i was trying till now. Any idea why that would happen?
Thank You, Soumen
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello Soumen,
The only thing I can think of is "myODBC connector" version you are using is the 32 bit one. Are you sure you did a download on the 64 bit one?
The download webpage is located at: http://dev.mysql.com/downloads/connector/odbc/5.1.html#winx64[^]
If that is not your issue and have verified the version of your "myODBC connector", I have nothing else to think of. For that I am very sorry! My suggestion then is to complete the migration at your 32-bit enviroment and then finally restore the database at your x64 platform.
Best regards,
Niklas Henricson
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Niklas,
I have the 64-bit version of the myODBC connector. I was myself surprised with this kind of behavior. Anyways i would do as you suggested. Use migration on the 32-bit environment and then restore on 64-bit.
Thank You, Soumen
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I follow your steps ,but I receive this message:
The test connection to the linked server failed.
------------------------------ ADDITIONAL INFORMATION:
" An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQL". OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". Microsoft SQL Server, Error: 7303)
so what I can do to solve this error ..
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
I tried this approach of creating linked server and then import the data but could'nt get success, then i tried using SSIS to import data from MySql to SQL Server and bingo it worked.
See this for further help
programmign techniques
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Well we are migrating to a 64-bit server and we are unable to get PHPBB3 to work with fusion-x lan 64-bit php using an ODBC connection to SQL Server 2005 so we are looking at using MySQL as the MySQL install works flawlessly. I saw this work and was hoping for a solution going in the other direction. Any ideas?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Can i migrate data from SQL Server to MySQL using some queries?
please help me on this...
I already google this one, but most of the forum tells on using some tools to do that...I dont want to use the tools,i want it to migrate using sql queries...
Please help me...
Thanks in advance
Ryan
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
I encountered a lot of the following errors with my implementation of this concept:
from MySQL: [MySQL][ODBC 5.1 Driver][mysqld-5.0.51a-community]MySQL client ran out of memory and from SQL 2005 Express: An error occurred while executing batch. Error message is: Exception of type 'System.OutOfMemoryException' was thrown.
...so I ended up doing the following T-SQL workaround that I created with some SQL DBA's help.
First, I added the linked server using:
EXEC master.dbo.sp_addlinkedserver @server = N'MYSQL', @srvproduct=N'MySQL', @provider=N'MSDASQL', @provstr=N'DRIVER={MySQL ODBC 3.51 Driver}; SERVER=[your IP/name here]; DATABASE=[db name here]; USER=[user here]; PASSWORD=[password here]; OPTION=3'
Then, the meat of what I was doing, basically just grabbing 1000 rows at a time (which was small enough that the MySQL connection could handle it) and inserting them into my SQL 2005 Express setup at the new host:
begin declare @maxID nvarchar(10); declare @maxID2 nvarchar(10); declare @mySqlSQL nvarchar(2000);
select @maxID = max(id) + 1, @maxID2 = max(id)+1000 from localDB.dbo.contacts
set @mySqlSQL = 'select * from contacts where id between ' + @maxID + ' and ' + @maxID2;
set @mySqlSQL = 'select * from openquery(MySQL, ''' + @mySqlSQL + ''')';
insert into localDB.dbo.contacts EXEC master.dbo.sp_executesql @mySqlSQL;
select max(id) AS idMax, count(id) AS idCount from localDB.dbo.contacts -- double check that I didn't grab any duplicates end
(lather, rinse and repeat the above...)
-------------
...Since I was linking to a database directly in my linked server setup, I also had the drop server handy for when I finished with one database and needed to move to the next one)
EXEC master.dbo.sp_dropserver @server='MYSQL', @droplogins='droplogins'
-------------
Mostly, this worked great for me because the table that I hit the most problems with had about 1.5MM records, which was going to take a while for me to hand-code 1000 records at a time.
Hope this helps someone save time, since I battled with this for 2 or 3 days before I got it to work!
-nate
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
hi i am getting this error : OLE DB provider "MSDASQL" for linked server "MYSQL" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "MYSQL".
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi Niklas
First thank you for posting your article.
It was a breeze until this point which I can not get around.
Major Error 0x80040E14, Minor Error 25501 > EXEC master.dbo.sp_addlinkedserver @server = N'MYSQL', @srvproduct=N'MySQL', @provider=N'MSDASQL', @provstr=N'DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost; DATABASE=test; USER=root; PASSWORD=; OPTION=3' There was an error parsing the query. [ Token line number = 1,Token line offset = 12,Token in error = . ]
I am using SQL 2005 and Sql Server Management Studio Express.
I successfully added the connection to my MySQL database using the ODBC Data Source Configuration and it tested OK.
Hope that you can help
David
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello David!
I tried to make a research regarding the error you've got and I couldn't find any good answer to that.
What I suggest is to create the link to your MySQL database manually instead. On the Object Explorer window in the management studio express, browse under "Server Objects"->"Linked Servers". Right click "Linked Servers" and choose the option "New Linked Server...", name it as "MySQL", choose the "Other data source", and inside the drop down list try to find the MySQL ODBC provider. Try to fill all that nessesary information and attempt to connect again.
If that doesn't help please inform me.
Best regards,
Niklas Henricson
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thank you very much for your reply and your help Niklas. I really appreciate that.
I tried what you suggested but in the New Linked Server window there are plenty of Microsoft options but not the MySQL provider.
I went back to control panel and the MySQL ODBS 5.1 Driver definitely exists and I can test connect to it.
I wonder if it is a permissions problem? I am on Vista which does have its own quirks at times.
(Even though SQLEXPRESS is on my PC, when I went to register it in SQL Server Management Studio Express, I found it under Network Servers in the Browse for Servers window.)
David
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |