🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Probleme insertion Oracle XSU

#9643
From: Stephane GAHAGNON
Date: Tue, 20 Feb 2001 09:52
62 lines
2706 bytes
Bonjour,
Je n'arrive pas a inserer certains tags (ID et NO) dans une base Oracle en 
utilisant la procedure XSU JAVA API (disponible avec Oracle XSU 111)
Pour compiler j'utilise : javac put.java
Pour executer : java put "put.xml"

Merci d'avance.

Voici mon XML:

<?xml version="1.0"?>
<DATABASE>
   <PERSONNE>
	<NO>1</NO>
	<NOM>toto</NOM>
	<PRENOM>titi</PRENOM>
   </PERSONNE>
   <PERSONNE>
	<NO>2</NO>
	<NOM>tutu</NOM>
	<PRENOM>tata</PRENOM>
   </PERSONNE>
</DATABASE>

Mon fichier put.java :

import java.sql.*;
import oracle.xml.sql.dml.OracleXMLSave;
public class put
{
   public static void main(String argv[])
     throws SQLException
   {
      Connection conn = getConnection("admin","admin");
      OracleXMLSave sav = new OracleXMLSave(conn, "test");
      String [] colNames = new String[40];
      colNames[0] = "NO";
      colNames[1] = "NOM";
      sav.setUpdateColumnList(colNames); // set the columns to update..!
      // Assume that the user passes in this document as the first 
argument!
      sav.insertXML(argv[2]);
      sav.close();
   }
   // Get the connection given the user name and password..!
    private static Connection getConnection(String user, String passwd)
      throws SQLException
    {
      DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
      Connection conn =
 
         DriverManager.getConnection("jdbc:oracle:oci8:@test","admin","a  
dmin");
     return conn;
   }
}

 

-- 
Posted from brest.ifremer.fr [134.246.155.1] 
via Mailgate.ORG Server - http://www.Mailgate.ORG
Technical Details
Message-ID: <01C09B2B.4292F480.sgahagno@ifremer.fr>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!freenix!teaser.fr!fr.clara.net!heighliner.fr.clara.net!news.tele.dk!212.177.105.133!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,d42fb50d713cd239,start
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2001-02-20 01:54:05 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!freenix!teaser.fr!fr.clara.net!heighliner.fr.clara.net!news.tele.dk!212.177.105.133!news.mailgate.org!brest.ifremer.fr!not-for-mail
From: sgahagno@ifremer.fr (Stephane GAHAGNON)
Newsgroups: fr.comp.text.xml
Subject: Probleme insertion Oracle XSU
Date: 20 Feb 2001 10:52:54 +0100
Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
Lines: 62
Message-ID: <01C09B2B.4292F480.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 982662772 7970 134.246.155.1 (Tue, 20 Feb 2001 10:52:38 +0100)
X-Complaints-To: brest.ifremer.fr@abuse.net abuse@mailgate.org
NNTP-Posting-Date: 20 Feb 2001 09:52:54 GMT
Mail-From: sgahagno@ifremer.fr from brest.ifremer.fr [134.246.155.1]
X-URL: http://www.Mailgate.ORG