2017-08-07 3 views
0

私は、scriptellaを使用してoracleからpostgresqlデータベースにデータをコピーしたいと思いますが、私は2つのデータベースに異なる型を持ちます。私は暗黙のうちにetlファイルを変換することができますか?ここ データ型が競合している間にApacheのスクリプトが使用されています

<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd"> 
<etl> 
    <description> 
     test script 
    </description> 
    <connection id="in" driver="oracle" url="jdbc:oracle:thin:@localhost:1521:XE" 
     user="test" password="test"> 

    </connection> 

    <connection id="out" driver="postgresql" 
     url="jdbc:postgresql://localhost:5432/testMonoprix2" user="postgres" 
     password="maher"> 
    </connection> 
    <query connection-id="in"> 
     SELECT LIBELLE, ADRESSE,MATFISC,CONTACT,TEL FROM IPTECH.TMP_FOURNISSEUR; 
     <script connection-id="out"> 
      UPDATE public.suppliers SET is_enabled='TRUE', label=?LIBELLE, address=?ADRESSE, tax_registration_number=?MATFISC,contact=?CONTACT, tel=?TEL; 
      </script> 

    </query> 
</etl> 

は、Javaコード

で、ここにあるエラー私は

import java.io.File; 
import scriptella.execution.EtlExecutor; 
import scriptella.execution.EtlExecutorException; 
public final class Test_Scriptella 
public static void main(String[] args) throws EtlExecutorException { 
     try { 
        EtlExecutor.newExecutor(new File("oracle_etl.xml")).execute(); 
         System.out.println("file executed"); 

       }catch(Exception ex) 
       { 
        System.out.println(ex.getMessage()); 
       } 
     } 
    } 

を持って、ここで私はそれを試したことがない私は

Location: /etl/query[1]/script[1] 
    JDBC provider exception: Unable to execute statement 
    Error statement: 
    UPDATE public.suppliers SET is_enabled='TRUE', label=?, address=?, tax_registration_number=?,contact=?, tel=?. Parameters: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, MONOPRIX LAFAYETTE, null, Neant, 891 656 ] 
    Error codes: [42804, 0] 
    Driver exception: org.postgresql.util.PSQLException: ERREUR: la colonne « tel » est de type bigint mais l'expression est de type character varying 
    Hint: Vous devez réécrire l'expression ou lui appliquer une transformation de type. 
    Position: 114 

答えて

0

を得た誤りであるが、 1つのオプションは、キャスト()関数を使用してintに変換することです:

UPDATE public.suppliers SET is_enabled='TRUE', label=?LIBELLE, address=?ADRESSE, tax_registration_number=?MATFISC,contact=?CONTACT, tel=cast(?TEL as bigint); 
関連する問題