🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.text.xml
Article #9666

re: re: probleme insertion oracle xsu

#9666
From: Stephane GAHAGNON
Date: Thu, 22 Feb 2001 12:56
61 lines
3097 bytes
En fait j'ai presque resolu mon probleme avec ce code. Les champs ID et NOM 
font partie d'une table et les PAYS et VILLE d'une autre.
Je ne sais pas comment faire pour inserer uniquement les champs ID et NOM 
dans la table concernee.

Voila l'erreur :
oracle.xml.sql.OracleXMLSQLException: Exception ' The XML element tag 
'PAYS' does not match the name of any of the columns/attributes of the 
target database object.' encoutered during processing ROW element 0All 
prior XML row changes were rolled back. in the XML document
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1962)
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1880)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1013)

Code java :

import oracle.xml.sql.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.jdbc.*;
import java.net.*;
public class put
{
   public static void main(String argv[])
     throws SQLException
   {
	DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
	Connection conn = 
DriverManager.getConnection("jdbc:oracle:oci8:admin/admin@test");
     	String tabName = "TEST";   // table into which to insert
	String fileName = "put.xml";   // the file containing the XML doc
	OracleXMLSave sav = new OracleXMLSave(conn,tabName);
	String [] colNames = new String[2];
    	colNames[0] = "ID";
	colNames[1] = "NOM";
	sav.setUpdateColumnList(colNames); // set the columns to update..!
	sav.setIgnoreCase(true);
	URL url = sav.createURL(fileName);
	int rowCount = sav.insertXML(url);
	System.out.println(" successfully inserted "+rowCount+" rows into 
"+tabName);
     conn.close();
   }
}

Fichier put.xml :
<?xml version = '1.0'?>
<ROWSET>
   <ROW>
      <ID>1</ID>
      <NOM>toto</NOM>
      <PAYS>france</FRANCE>
	<VILLE>Paris</VILLE>
   </ROW>
</ROWSET>

Merci d'avance pour vos reponses.

-- 
Posted from brest.ifremer.fr [134.246.155.1] 
via Mailgate.ORG Server - http://www.Mailgate.ORG
Technical Details
Message-ID: <01C09CD7.325E0CA0.sgahagno@ifremer.fr>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!grolier!btnet-peer0!btnet!news.mailgate.org!brest.ifremer.fr!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114f60,c0095c379eae8812
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2001-02-22 04:58:03 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!grolier!btnet-peer0!btnet!news.mailgate.org!brest.ifremer.fr!not-for-mail
From: sgahagno@ifremer.fr (Stephane GAHAGNON)
Newsgroups: fr.comp.text.xml
Subject: re: re: probleme insertion oracle xsu
Date: 22 Feb 2001 13:56:14 +0100
Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
Lines: 61
Message-ID: <01C09CD7.325E0CA0.sgahagno@ifremer.fr>
NNTP-Posting-Host: brest.ifremer.fr
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.mailgate.org 982846572 30704 134.246.155.1 (Thu, 22 Feb 2001 13:55:54 +0100)
X-Complaints-To: brest.ifremer.fr@abuse.net abuse@mailgate.org
NNTP-Posting-Date: 22 Feb 2001 12:56:15 GMT
Mail-From: sgahagno@ifremer.fr from brest.ifremer.fr [134.246.155.1]
X-URL: http://www.Mailgate.ORG