21, March 2010

How to Convert informix to MySQL? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  Databases  >  MySQL
Topic: How to Convert informix to MySQL?
« previous next »
Pages: [1] 2 3 Print

Author Topic: How to Convert informix to MySQL?  (Read 6022 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« on: Jul 08, 2006, 02:37:33 am »

I've got some data that was exported from Informix, how do I convert the data to MySQL?


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 08, 2006, 09:38:01 am »

I've got some data that was exported from Informix, how do I convert the data to MySQL?
can you post some example data?


Last blog : A new Wordpress theme for our blog
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #2 on: Jul 08, 2006, 10:42:23 am »

The data is |-seperated so it looks something like this:

234234|AAAA|abcd|2006-03-04

The SQL looks like this:
Code:
{ TABLE "itis".change_comments row size = 263 number of columns = 4 index size =
              30 }
{ unload file name = chang00100.unl number of rows = 0 }

create table "itis".change_comments
  (
    change_track_id integer not null ,
    chg_cmt_id serial not null ,
    change_detail varchar(250,1) not null ,
    update_date date not null
  );
revoke all on "itis".change_comments from "public";


and then after all the table definitions there's some key and constraints defenitions:
Code:
create unique index "itis".change_comments_ky on "itis".change_comments
    (change_track_id,chg_cmt_id) using btree ;
alter table "itis".change_comments add constraint primary key
    (change_track_id,chg_cmt_id) constraint "itis".u111_1  ;

and
Code:
update statistics medium for table comments (
     comment_detail, comment_id, comment_time_stamp, commentator, update_date)
     resolution   2.50000   0.95000 ;
« Last Edit: Jul 08, 2006, 10:56:05 am by Mind_nl »


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jul 08, 2006, 11:21:24 am »

do you have phpmyadmin?


Last blog : A new Wordpress theme for our blog
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #4 on: Jul 08, 2006, 11:52:36 am »

yes


Last blog : Are You Stumbling Yet?
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Jul 08, 2006, 12:06:09 pm »

first you have to create a table (is easy, read the beginners tutorials) and then locate this option "Insert data from a textfile into table" (tab sql) 
that's all


Last blog : A new Wordpress theme for our blog
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #6 on: Jul 08, 2006, 12:55:16 pm »

yes, I know how to create a table in phpMyAdmin. The problem is that the exported SQL doesn't work. The posted data is just a sample, there are a lot of tables in the database with a lot of constraints and indexes. It would be nice if there would be a tool to translate the Informix SQL to MySQL SQL. I've see some commercial tools for this, but I'm looking for the cheap way...


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #7 on: Jul 08, 2006, 01:01:56 pm »

Try to create your tables by hand, and then import the data.

I don't think there is an open source translator for informix to mysql

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #8 on: Jul 08, 2006, 01:06:44 pm »

can I use the
Code:
update statistics medium for table comments (
     comment_detail, comment_id, comment_time_stamp, commentator, update_date)
     resolution   2.50000   0.95000 ;
command in MySQL? I know alot about SQL on iSeries (IBM DB2) but never seen 'update statistics medium'


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #9 on: Jul 08, 2006, 01:09:14 pm »

can I use the
Code:
update statistics medium for table comments (
     comment_detail, comment_id, comment_time_stamp, commentator, update_date)
     resolution   2.50000   0.95000 ;
command in MySQL? I know alot about SQL on iSeries (IBM DB2) but never seen 'update statistics medium'

It is the first time I see this. Propably you can't do that with mySQL

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6690
34708 credits
Members referred : 374


It's time to use PHP5!


« Reply #10 on: Jul 08, 2006, 04:45:15 pm »

yes, I know how to create a table in phpMyAdmin. The problem is that the exported SQL doesn't work. The posted data is just a sample, there are a lot of tables in the database with a lot of constraints and indexes. It would be nice if there would be a tool to translate the Informix SQL to MySQL SQL. I've see some commercial tools for this, but I'm looking for the cheap way...
how many tables do you have 100 ? just create a few tables manually and if you want to translate all sql statements (update, insert, select...), be carefull you are running on thin ice...


Last blog : A new Wordpress theme for our blog
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #11 on: Jul 12, 2006, 09:09:16 pm »

Oke, I've created the tables manually, now to upload the data...
The data I have looks like this:

1|aaa|03/26/2005|
2|bbb|02/14/2006|

How can I upload this data in phpMyAdmin?
I've tried about every option but I'm getting errors or not the data I expect...


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #12 on: Jul 12, 2006, 09:27:09 pm »

Why don't you do it manually?

For the example I see you will need something like :

Code:
<?php
$records 
explode("\n"$input); //$input = the data you have
foreach ( $records as $l )
{
    
$rec explode('|'substr($l,0,-1));
    
//Do something with the $rec
}

Hope that helps Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #13 on: Jul 12, 2006, 10:01:06 pm »

yeah that sounds good! but:
1. how do I get the data in $input (do I load the whole file at once?)
2. I get the $rec = explode('|' but where do I find the 3 values after the explode (so what do I need to use on the INSERT?
Thanks!


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #14 on: Jul 12, 2006, 10:06:35 pm »

1. If the file ia too big, it would be better to use fgets, but you wont have any problem with files bigger than 500 mb.

2. After the explode, $rec[0] is the first value, $rec[1] is the second, etc. If you are asking wich field goes with each value, then this is not a problem as in mysql you can say INSERT INTO table (value1,value2,value3,.....)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #15 on: Jul 12, 2006, 10:34:00 pm »

The biggest file is 50 MB, so I guess it can be done in one go?
How do I get the file content into $input?


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #16 on: Jul 12, 2006, 10:38:44 pm »

The biggest file is 50 MB, so I guess it can be done in one go?
How do I get the file content into $input?

Yes it will be ok.

Grab the contents with this :

Code:
<?php
 $input 
file_get_contents'filename_with_path.sql' );

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #17 on: Jul 12, 2006, 10:42:23 pm »

cool, thanks man!


Last blog : Are You Stumbling Yet?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #18 on: Jul 13, 2006, 11:24:27 am »

I'm filling up the database, the first couple of file went oke, but I'm getting errors now. I think the error is because of commas in the field value. What would be the best way to fix this?
The data looks like this:

123|aaa,2|bbb


Last blog : Are You Stumbling Yet?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5660
45593 credits
Members referred : 3



« Reply #19 on: Jul 13, 2006, 11:28:57 am »

I'm filling up the database, the first couple of file went oke, but I'm getting errors now. I think the error is because of commas in the field value. What would be the best way to fix this?
The data looks like this:

123|aaa,2|bbb
The problem is not the comma. Do you use ' for every value that you insert?

What is the error that you get?

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3192
Tags : php mysql databases php.ini Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] 2 3 Print 
Webdigity Webmaster Forums  >  Web Development  >  Databases  >  MySQL
Topic: How to Convert informix to MySQL?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Mar 21, 2010, 03:16:02 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 44.235
Total Topics: 8.624
Total Members: 8.243
Tutorials : 58
Resources : 929
Designs : 361
Latest Member: ericmartin225

31 Guests, 4 Users online :

8 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2010 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.