Oracle table to XML
Date: Mon, 3 Sep 2001 09:52:39 +0200
Message-ID: <9mvcok$dd3$1_at_naxos.belnet.be>
Hello ,
[Quoted] I want to get data from an Oracle dbase ( 8i ) into a XML-file ...
I found this JAVA-example on the net ...
import oracle.jdbc.driver.*;
import oracle.xml.sql.query.OracleXMLQuery;
import java.lang.*;
import java.sql.*;
// class to test XML document generation as String class testXMLSQL {
public static void main(String[] args) {
try {
// Create the connection
Connection conn = getConnection("scott","tiger");
// Create the query class
OracleXMLQuery qry = new OracleXMLQuery(conn, "SELECT * FROM FXTRADE");
// Get the XML string
String str = qry.getXMLString();
// Print the XML output
System.out.println("The XML output is:\n"+str);
// Always close the query to get rid of any resources..
qry.close(); } catch(SQLException e) { System.out.println(e.toString()); }
}
// Get the connection given the user name and password.! private static Connection getConnection(String username,
String password) throws SQLException {
// register the JDBC driver..
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Create the connection using the OCI8 driver
Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:_at_dlsun489:1521:ORCL", username,password); return conn;
}
}
I understand the example but ... I get the fault that he can't import the "oracle.xml.sql.query.OracleXMLQuery "-package ? I'm using JDeveloper ( 3.2.3 ) . On the website where I found the example stood that it have to work under Jdeveloper.
Do I have to import a package ? And if so , which package ?? and where can I
download it ?
[Quoted] Or does I have to load a new JDeveloper ??
Or doesn't it work under Oracle 8i ???
Greetings
Steven
Received on Mon Sep 03 2001 - 09:52:39 CEST