File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generate Xml thru database

 
Abhishek Kumar
Ranch Hand
Posts: 52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to generate a xml file from a table in the database.the database being Oracle 8i and java-1.4.now,i am not even able to compile the program.Infact eclipse is stick with the red mark saying the following package doesnot exist.I dont know exactly but i thinl there is some jar problem in my classpath.There may be a few jars in 9i and i may not have it.The packege name is

:--oracle.xml.sql.query.*; we have a class in this package called OracleXMLQuery which does all the work but package pbm.So please suggest what to do???/


Here is my code :---

package com.velozglobal.mcube;

import java.sql.*;
import java.math.*;
import oracle.xml.sql.query.*;
import oracle.jdbc.*;
import oracle.jdbc.driver.*;

public class Xmlquerydb
{
public static void main(String args[]) throws SQLException
{
String tabName = "Abhishek";
String user = "scott/tiger";

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

//initiate a JDBC connection
Connection conn =
DriverManager.getConnection("jdbc racle ci8:"+user+"@");

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

// structure the generated XML document
qry.setMaxRows(2); // set the maximum number of rows to be returned
qry.setRowsetTag("ROOTDOC"); // set the root document tag
qry.setRowTag("DBROW"); // sets the row separator tag
qry.setStyleSheet("emp.xsl"); // sets the stylesheet

// get the XML document in string format
String xmlString = qry.getXMLString();

// print out the XML document
System.out.println(" OUTPUT IS:\n"+xmlString);
}
}
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you imported the Oracle specific into the project library Path ?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic