Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
【Allora】Unmarshal: XML から DB へ
Ver 1.0
2014 年 1 月 22 日
株式会社クライム
【Allora】Unmarshal: XMLから DBへ
‐1‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step1: Tools メニュから「Unmarshal XML/Text to DB Wizard」を選択します。
【Allora】Unmarshal: XMLから DBへ
‐2‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step2: 「Unmarshal XML to DB operation」と「Generate Java code」をウィンドウ上で選択します。 Nextをクリックします。
【Allora】Unmarshal: XMLから DBへ
‐3‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step 3: XML Data Source と DB Data Destination を指定し、Nextをクリック。
【Allora】Unmarshal: XMLから DBへ
‐4‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step4: ディレクトリから XML/Text file名を指定し、Nextをクリック。
【Allora】Unmarshal: XMLから DBへ
‐5‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step5: The database Connection information is needed to connect the Database.データベースに接続するためにデータベース接続情報が必要です。Driver Name, URL , Username, Password を指定し、Next をクリック。
【Allora】Unmarshal: XMLから DBへ
‐6‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step6: Database Table名を指定し、Nextをクリック。
【Allora】Unmarshal: XMLから DBへ
‐7‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step7: ここでMarshal optionsを設定し、Nextをクリック。
【Allora】Unmarshal: XMLから DBへ
‐8‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step8: Java Class名、Package名、JDKインストール・ディレクトリ、Alloraディレクトリ、License Fileロケーションを指定。
【Allora】Unmarshal: XMLから DBへ
‐9‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step9: コード生成パスの指定。もし変更が必要であれば、パスのロケーションを変更します。 次にNextをクリック。
【Allora】Unmarshal: XMLから DBへ
‐10‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
Step10: 詳細情報(Summary )が表示されます。次に Finishをクリック。
次の Javaファイルが生成されます。: /** * UnmarshalProduct.java 2006/06/13 * * This code has been generated by the Allora Mapper from HiT Software Inc. * Any changes made to this file will be lost when it is regenerated. */ package com.hitsw.allora; import java.io.*; import com.hitsw.xml.databinding.*; public class UnmarshalProduct { public static void main(String argv[]) { importXML(); } public static void importXML() {
【Allora】Unmarshal: XMLから DBへ
‐11‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
// remove comment to generate the trace file // System.setProperty("com.hitsw.xml.databinding.traceFlag","true"); // System.setProperty("com.hitsw.xml.databinding.traceStream","c:/trace.trc"); XMLRecordset recordset = XMLRecordsetBuilder.newInstance(); try { // initialize the connection properties recordset.setProvider("sun.jdbc.odbc.JdbcOdbcDriver"); recordset.setUrl("jdbc:odbc:allora"); // set the database table name recordset.setTable("商品 1"); // set the encoding of input XML file recordset.setEncoding("UTF-8"); // set the file name for the input XML recordset.setInputXML("C:¥¥Program Files¥¥HiT Software¥¥Allora-4.2-4¥¥marshalwiz¥¥output.xml"); recordset.setInputXMLSystemId("C:¥¥Program Files¥¥HiT Software¥¥Allora-4.2-4¥¥marshalwiz"); // start the transaction recordset.beginTrans(XMLRecordset.TRANSACTION_READ_COMMITTED); // start the unmarshal process recordset.unmarshalXMLStream(); // commit the transaction recordset.commitTrans(); } catch (XMLRecordsetException e) { System.out.println(e); try { recordset.rollbackTrans (); } catch (XMLRecordsetException ex) { System.out.println(ex); } } finally { try { recordset.deleteInstance(); } catch (Exception ex) {} } } } 結論:XMLコンテンツはデータベースに変換され、商品 1というデータベース・テーブルが生成されました。
【Allora】Unmarshal: XMLから DBへ
‐12‐ Copyright(C)2013 Climb.Inc. All Rights Reserved.
©株式会社クライム
〒103-0014 東京都中央区日本橋蛎殻町 1-36-7 蛎殻町千葉ビル4F TEL: 03-3660-9336 FAX:03-3660-9337 URL: www.climb.co.jp Email: [email protected]