Jump to content

INFORMIX --> MYSQL MIGRATION ENGINE


tapius1

Recommended Posts

I need help with some code, im connecting to two databases on different machines and would like to run a query in which i fetch values from one db table and insert them into another using a primary key to identify what goes where. The code runs but the query doesn't every insert the values. Maybe someone could help me out. I'm moving a TON of data, 30,000 records per day, for a total for 3 months.. im trying to just accomplish 1 day at a time.. also phpED stopped query execution after 300 seconds, i wanted to know if this is a limit in php or just my IDE.

anyway heres my code, tell me if theres something wrong with my insertion statement

 

<?php

//connect to VOICE RECORDING DATABASE
$conn =  odbc_connect("dsn1","user","pass"); 
mysql_selectdb("dsn1");

if ($conn) {
   echo "Connection 1 succeeded.<br />";
   //connect to second database     
   
   $conn2 = odbc_connect("dsn2","root","pass"); 
   //mysql_select_db("dsn2");    
   
if ($conn2) {
   echo "Connection 2 succeeded.<br />";
   //initiate SQL query to second database connection     .....date  mmddyyyy
             $query2 = "SELECT * FROM rec_playint WHERE call_date = '07092009'"; 
             //query to first database connection
             $query = "SELECT * FROM mysql.dsn1";   
             
             //return result sets numresults, and numresults2 for each of the queries   
             $numresults = odbc_exec($conn, $query);
             $numresults2 = odbc_exec($conn2, $query2);
             
             //echo the results in a while loop
//    while($row = odbc_fetch_array($numresults2))
//{
//    echo "{$row['call_date']}<br />" . 
//         "{$row['call_time']}<br />" . 
//         "{$row['tsr']}<br><br />";         
//         //echo the result for the other database
//         $row2 = odbc_fetch_array($numresults);  
//         echo "{$row2['NobleCallID']}<br><br />";    
//}  
        while($row = odbc_fetch_array($numresults2))
{
    //while fetching arrays in connection 2 (dsn2 - NOBLE) insert into the $row2 Voice Recording Table
      $query = "INSERT INTO mysql.dsn1
              (RecDate, RecTime, AgentID) 
              VALUES ({$row['call_date']},{$row['call_time']}, {$row['tsr']}) 
              WHERE NobleCallID = {$row['file_num']} ";
      echo "{$row['call_date']} " . "{$row['call_time']} " .  "{$row['tsr']}" .  "{$row['file_num']}";         
}  
   echo "finished";         
   odbc_close($conn);
   odbc_close($conn2); 
   echo "both connections have been closed";
}

else {
   echo "Connection failed.<br />";
   echo odbc_errormsg();
}

}

?>

Link to comment
Share on other sites

  • 3 weeks later...

Maybe anyone could advice me out. I'm affective a TON of data, 30,000 annal per day, for a absolute for 3 months.. im aggravating to just achieve 1 day at a time.. aswell phpED chock-full concern beheading afterwards 300 seconds, i capital to apperceive if this is a absolute in php or just my IDE.

 

_________________

Business process automation

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.