 |
|
 |
Hi Niklas,
thanks for this nice article, almost everything went smoothly. But I do have a few questions:
1. In this script:
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=tigerdb; USER=root; PASSWORD=hejsan; OPTION=3'
What does the option=3 stand for?
And now my real problem, where I need help with:
That's the script I'm running:
SELECT * INTO mysqlforum.dbo.shoutbox
FROM openquery(mysql, 'SELECT * FROM mysql')
In your own script the last line ends with FROM tigerdb.shoutbox, but that shoutbox part, I don't have that actually. My database is just called mysql.
When I run the script MSSQL 2008 gives me following error:
OLE DB provider "MSDASQL" for linked server "mysql" returned message "[MySQL][ODBC 5.1 Driver][mysqld-5.1.53-community-log]No database selected".
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "MSDASQL" for linked server "mysql".
What does this error means?
A bit of background information:
The mysql db I want to migrate is part of the WAMP server. I do have a second DB, it's the InformationSchema.
Any advice is appreciated.
Kind regards,
Jay
|
|
|
|
 |
|
 |
For all others, I could solve my problem as it was due to a few misunderstandings of the scripts above.
|
|
|
|
 |
|
 |
Hi!
I've got an error message when trying to select from MySql database:
Query:
SELECT * FROM openquery(INTERSPIRE2, 'SELECT * FROM send.ss_newsletters')
Error message:
OLE DB provider "SQLNCLI" for linked server "INTERSPIRE2" returned message "Login timeout expired".
OLE DB provider "SQLNCLI" for linked server "INTERSPIRE2" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].
What could be wrong?
Thanks in advence!
|
|
|
|
 |
|
 |
Mihaly Sogorka wrote: "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."
Like the message indicates you need to allow your SQL server, remote connections. Creation of database links are clasified as such. Go to your SQL Server Configuration Manager and check your settings, or look for help by searching at MSDN troubleshooting pages.
Niklas Henricson
|
|
|
|
 |
|
 |
I have run the script
EXEC master.dbo.sp_addlinkedserver
@server = N'MYSQL',
@srvproduct=N'MySQL',
@provider=N'MSDSQL',
@provstr=N'DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;DATABASE=test; PASSWORD=alam; OPTION=3'
But when I run the following script:
SELECT * INTO testMySQL.dbo.shoutbox
FROM openquery(MYSQL, 'SELECT * FROM test.aa')
I get the error:
Msg 7403, Level 16, State 1, Line 1
The OLE DB provider "MSDSQL" has not been registered.
So how Can I solve the problem?
Thanks in Advaance........
|
|
|
|
 |
|
 |
Hello,
It would seem that your MySQL ODBC provider was not installed properly. Either install a new one, or try by reinstalling it. This is pure installation and configuration issue I cannot help you much with.
Niklas Henricson
|
|
|
|
 |
|
 |
Thank you for sharing this with us, this is what I need now.
However, I stuck at the very beginning, when I try to install a new ODBC data source, I don't even see "MySQL ODBC 5.1 Driver" like in your second screenshot in the post.
What's missing here?
Thank you very much.
The email I registered for CodeProject is full of spam now, if you know how to fix it, could you please send me email at xie3208080 gmail com?
Thanks again and hoping to hearing from you soon.
|
|
|
|
 |
|
 |
At the time I was writing this article things have changed. Did you use the same environment I specify on the top of the article (SQL Server 2005, Win XP)? Try reinstalling your mySQL ODBC provider or download a newer one. If you are using Windows 7, Windows 8 alfa or any other newer operating system, configuration settings might be relocated.
Niklas Henricson
|
|
|
|
 |
|
 |
I want to migrate a full db into mssql express and so far I have done for one table. I have several tables and it would take a long time to do it and probabaly I'll do this with other databases as well. Could you direct me to a page where I can learn fast script for ms sql. Or show me the general way to loop through tables in a db?
Thanks
|
|
|
|
 |
|
 |
We have created an opensource database plugin for MySQL that allows to insert data directly in oracle from within MySQL. You can also do both, query oracle tables or insert/update/delete oracle table data just like a JDBC connector but without the need to do any Java/Perl/PHP code.
The plugin that I have written that is compatible Debian/Redhat/Windows platforms and MySQL 5.1.X and 5.5.X
The plugin works the same way as an MySQL Federated table or as a ORACLE DBLINK type of thing...
You create a table and you set the connection string to an Oracle, MySQL, MSSQL server and table name.
Feel free to try the MySQL Plugin at : https://launchpad.net/datacontroller
you can also visit our website and ask for more information via the download page or forum @ http://www.theacesolutions.com/
Thanks
|
|
|
|
 |
|
 |
Please do not commercialize any products here. If you follow the GNU license over your product refer instead to your own article rather then misleading people to download a shareware.
Best regards,
Niklas Henricson
Niklas Henricson
|
|
|
|
 |
|
 |
I tried to convert in MySQL7 but some table was not able to convert and displayed the following error message
Server: Msg 8114, Level 16, State 10, Line 1
Error converting data type DBTYPE_DBDATE to datetime.
|
|
|
|
 |
|
 |
I am sorry I'm not good in resolving or interpreting MySQL errors, please refer to their documentation.
Niklas Henricson
|
|
|
|
 |
|
 |
Hi there,
i tried that script yesterday to move data from mysql to mssql database. That worked fine using ur guide. But my database has about 50 different tables and i want to migrate all of them into the mssql database.
So is there a way to automatically copy the whole database / every table found in the source database and not table by table "by hand"?
Thx
|
|
|
|
 |
|
 |
It is possible to create a script that automates the migration, but it is part of database development to sometimes do it by trial and error, trying one by one table. That is the most common practice within database developers, before they generate a final script that will be ran in their production environment.
I'm sorry but I'm not aware of any automated solutions or products that would make this easier somehow.
Niklas Henricson
|
|
|
|
 |
|
 |
Very cool article. I was able to pull several databases into MSSQL using this technique. However, I have a log db that's about 25G and it just dies (runs out of memory) trying to import it wholesale. So I thought I'd use a where statement to break up the output. The only trouble is, after the first import it says the database object already exists. Well, yes, but why is that a problem? Is there a way to do this that would append to the database?
|
|
|
|
 |
|
 |
Google was my friend I should've checked there first, but here's the answer to my problem if anyone else runs into this:
INSERT INTO database.dbo.table
SELECT * FROM openquery(linked_server, 'SELECT * from db.table where DateColumn < "20071231" AND DateColumn >= "20071201"');
|
|
|
|
 |
|
 |
This is an excellent way to migrate a database. You have helped me enormously!
Thank you, thank you, thank you.
|
|
|
|
 |
|
 |
I'm happy the article helped you out!!
Niklas Henricson
|
|
|
|
 |
|
|
 |
|
 |
Thank you! I'm glad the article helped you out!
Niklas Henricson
|
|
|
|
 |
|
 |
Niklas,
Thanks for the great article, I had to tweek it a bit as I'm accessing an MySQL database on an Ubuntu server but this gave me a solid base to work from.
Thanks,
Mike
"It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.
Semper Fi
http://www.hq4thmarinescomm.com[ ^]
My Site
|
|
|
|
 |
|
 |
Thanks for the great 'how-to' this works perfectly as long as you follow the steps exactly as written. Saved me a lot of time and headaches.
|
|
|
|
 |
|
 |
Glad to be of assistance
Niklas Henricson
|
|
|
|
 |
|
 |
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.
|
|
|
|
 |