Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Compilation error on sample java program for xml parser

164149Jan 14 2002
Hi -


I am trying to run this simple example (given in the document "Using XML in Oracle Database Aplications").

I have the following installed.


c:\jdk1.3.1_01

c:\j2sdkee1.3

d:\xdk (version 9.0.1.2.0)


classpath contains $orahome\jdbc\lib\classes111.zip; d:\xdk\lib\xmlparserv2.jar

When I try to compile the program,
javac xmlquerydb.java
it gives the following error messages:

package oracle.xml.sql.query does not exist

package oracle.jdbc does not exist

OracleXMLQuery cannot resolve symbol

etc.





Aparently its not finding the xmlparser classes in xdk (even though its in the classpath).




PROGRAM
-------

//The following java code queries the database and constructs
// an XML file containing the results. The query is a select
// EMPNO, ENAME from EMP.



import java.sql.*;

import java.math.*;

import oracle.xml.sql.query.*;

import oracle.jdbc.*;

import oracle.jdbc.driver.*;



class xmlquerydb

{

public static void main(String[] args) throws SQLException

{

String tabName = "emp";

String user = "scott/tiger";


DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());



//initiate a JDBC connection

Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@world:1521:acme", "scott", "tiger");



//initialize the OracleXMLQuery

OracleXMLQuery qry = new OracleXMLQuery(conn, "select EMPNO, ENAME from "+tabName);



//structure the generated XML document

qry.setManRows(2);
qry.setRowsetTag("ROOTDOC");

qry.setRowTag("DBROW");
qry.setStyleSheet("emp.xsl");


//get the XML document in string format

String xmlString = qry.getXMLString();



//print out the XMLdocument

System.out.println("OUTPUT IS:\n"+xmlString);

}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2002
Added on Jan 14 2002
1 comment
404 views