• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 538
  • Last Modified:

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...
0
KGT
Asked:
KGT
2 Solutions
 
robknowlesCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
rmaranhaoCommented:
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 AhujaCommented:
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now