Oracle® Application Server
XML Java API Reference
10g Release 3 (10.1.3)

B28238-01


oracle.xml.xmldbaccess
Class XMLDBAccess

java.lang.Object
  extended byoracle.xml.dbaccess.DBAccess
      extended byoracle.xml.xmldbaccess.XMLDBAccess


public class XMLDBAccess
extends DBAccess

This Bean is a simple extension of the DBAccess bean to support the XMLType Functionality that was introduced as a part of Oracle 9i database This bean lets user to create XMLType tables and store XML documents. The XMLDocuments are stored as rows in the database table as an XMLType type. This class also provides methods to list, delete or retrieve XMLtype tables and data. The table is created using the SQL statement CREATE TABLE (FILENAME CHAR( ) UNIQUE, FILEDATA sys.XMLType);


Field Summary

Fields inherited from class oracle.xml.dbaccess.DBAccess
nameSize

Constructor Summary
XMLDBAccess()

Method Summary
boolean createXMLTypeTable(java.sql.Connection con, java.lang.String tablename)
Create an XMLType table
java.sql.Clob getXMLTypeClob(java.sql.Connection con, java.lang.String tablename, java.lang.String xmlname)
Retrieve text file from an XMLType table
java.lang.String getXMLTypeData(java.sql.Connection con, java.lang.String tablename, java.lang.String xmlname)
Retrieve text file from an XMLType table
java.lang.String[] getXMLTypeTableNames(java.sql.Connection con, java.lang.String tablePrefix)
Get all XML tables with names starting with a given string
java.sql.Clob getXMLTypeXPathCLOB(java.sql.Connection con, java.lang.String tablename, java.lang.String xmlname, java.lang.String xpathexp)
Retrieve the Clob data based on the XPATH expression from an XMLType table
java.lang.String getXMLTypeXPathTextData(java.sql.Connection con, java.lang.String tablename, java.lang.String xmlname, java.lang.String xpathexp)
Retrieve the text data based on the XPATH expression from an XMLType table
boolean insertXMLTypeData(java.sql.Connection con, java.lang.String tablename, java.lang.String xmlname, java.lang.String xmldata)
Inserts text file as a row in an XMLType table
boolean isXMLTypeTable(java.sql.Connection con, java.lang.String tablename)
Check if the table is an XMLType table.
boolean replaceXMLTypeData(java.sql.Connection con, java.lang.String tablename, java.lang.String xmlname, java.lang.String xmldata)
Replace text file as a row in an XMLType table

Methods inherited from class oracle.xml.dbaccess.DBAccess
createBLOBTable, createXMLTable, deleteBLOBName, deleteXMLName, dropBLOBTable, dropXMLTable, getBLOBData, getNameSize, getXMLData, getXMLNames, getXMLTableNames, insertBLOBData, insertXMLData, isXMLTable, replaceXMLData, xmlTableExists

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

XMLDBAccess

public XMLDBAccess()

Method Detail

isXMLTypeTable

public boolean isXMLTypeTable(java.sql.Connection con,
                              java.lang.String tablename)
                       throws java.lang.Exception
Check if the table is an XMLType table.
Parameters:
con - - the Connection object
Returns:
true if this is an XMLType table
Throws:
java.lang.Exception

getXMLTypeTableNames

public java.lang.String[] getXMLTypeTableNames(java.sql.Connection con,
                                               java.lang.String tablePrefix)
                                        throws java.lang.Exception
Get all XML tables with names starting with a given string
Parameters:
con - - the Connection object
tablePrefix - - table prefix string
Returns:
- array of all XMLType tables that begin with tablePrefix
Throws:
java.lang.Exception

createXMLTypeTable

public boolean createXMLTypeTable(java.sql.Connection con,
                                  java.lang.String tablename)
                           throws java.lang.Exception
Create an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
Returns:
true if successful
Throws:
java.lang.Exception

insertXMLTypeData

public boolean insertXMLTypeData(java.sql.Connection con,
                                 java.lang.String tablename,
                                 java.lang.String xmlname,
                                 java.lang.String xmldata)
                          throws java.sql.SQLException,
                                 java.io.IOException,
                                 java.lang.NoClassDefFoundError
Inserts text file as a row in an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
xmlname - - the file name
xmldata - - string with the file data
Returns:
true if successful
Throws:
java.sql.SQLException
java.io.IOException
java.lang.NoClassDefFoundError

replaceXMLTypeData

public boolean replaceXMLTypeData(java.sql.Connection con,
                                  java.lang.String tablename,
                                  java.lang.String xmlname,
                                  java.lang.String xmldata)
                           throws java.lang.Exception,
                                  java.lang.NoClassDefFoundError
Replace text file as a row in an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
xmlname - - the file name
xmldata - - string with the file data
Returns:
true if successful
Throws:
java.lang.Exception
java.lang.NoClassDefFoundError

getXMLTypeData

public java.lang.String getXMLTypeData(java.sql.Connection con,
                                       java.lang.String tablename,
                                       java.lang.String xmlname)
                                throws java.sql.SQLException
Retrieve text file from an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
xmlname - - the file name
Returns:
file as a string
Throws:
java.sql.SQLException

getXMLTypeClob

public java.sql.Clob getXMLTypeClob(java.sql.Connection con,
                                    java.lang.String tablename,
                                    java.lang.String xmlname)
                             throws java.sql.SQLException
Retrieve text file from an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
xmlname - - the file name
Returns:
file as a Clob
Throws:
java.sql.SQLException

getXMLTypeXPathTextData

public java.lang.String getXMLTypeXPathTextData(java.sql.Connection con,
                                                java.lang.String tablename,
                                                java.lang.String xmlname,
                                                java.lang.String xpathexp)
                                         throws java.sql.SQLException
Retrieve the text data based on the XPATH expression from an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
xmlname - - the file name
xpathexp - - XPATH expression to search the XML document
Returns:
the data as a string
Throws:
java.sql.SQLException

getXMLTypeXPathCLOB

public java.sql.Clob getXMLTypeXPathCLOB(java.sql.Connection con,
                                         java.lang.String tablename,
                                         java.lang.String xmlname,
                                         java.lang.String xpathexp)
                                  throws java.sql.SQLException
Retrieve the Clob data based on the XPATH expression from an XMLType table
Parameters:
con - - the Connection object
tablename - - the table name
xmlname - - the file name
xpathexp - - XPATH expression to search the XML document
Returns:
the data as a Clob
Throws:
java.sql.SQLException

Oracle® Application Server
XML Java API Reference
10g Release 3 (10.1.3)

B28238-01


Copyright © 2003, 2006, Oracle. All rights reserved.