howto copy over content from odbc databse to mysql

I would like to know how I can make a php script that copies over all data from a specifiek ODBC database or table in a database to a mysql database or table.

I know how to make a connection to an odbc source with the php function odbc_connect and a mysql source with mysql_connect, but what kind of query can I use to copy everything over?

Is it anyhow possible to do this with one simple query or do I need to use arrays?

Thanks in advance...
LVL 1
KGTAsked:
Who is Participating?
 
robknowlesConnect With a Mentor Commented:
You could use an sql select query with the ODBC connection, retrieve all the data from that table, then process it row by row and insert it into the MySQL table.  That would be my first idea on how to do this.

Of course, the two tables would need to have the same structure otherwise you could run into problems.
0
 
KGTAuthor Commented:
I was thinking the same thing. The structure is no problem, while I already setup several tables with the same structure in MySQL. All I need is some example code that could work, because I really don't know how to do it...
0
 
KGTAuthor Commented:
anybody?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
rmaranhaoConnect With a Mentor Commented:
If your ODBC source (suppose you're using SQL Server) can somehow access the MySQL DB, then a query like


insert into mySQL.TABLE(field1, field2) select field1, field2 from SQL.Table

could run, but I cannot make it work.

What is the ODBC source?
0
 
KGTAuthor Commented:
The ODBC source is a special format called PASSDATA from a company called MegaWorks. It came with a (slow) ODBC driver. This makes that queries throught the ODBC run very slow incomparison with the same queries in a mysql DB.

I will give your solution a try...
0
 
Kshitij AhujaTechnology DeveloperCommented:
No comment has been added to this question in more than 21 days,so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
[Points Split {rmaranhao}and {robknowles}]

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Kshitij Ahuja
EE Cleanup Volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.