BEA Systems, Inc.


weblogic.apache.xalan.lib.sql
Class XConnection

java.lang.Object
  |
  +--weblogic.apache.xalan.lib.sql.XConnection

public class XConnection
extends java.lang.Object

An XSLT extension that allows a stylesheet to access JDBC data. From the stylesheet perspective, XConnection provides 3 extension functions: new(), query(), and close(). Use new() to call one of XConnection constructors, which establishes a JDBC driver connection to a data source and returns an XConnection object. Then use the XConnection object query() method to return a result set in the form of a row-set element. When you have finished working with the row-set, call the XConnection object close() method to terminate the connection.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Constructor Summary
XConnection()
           
XConnection(ExpressionContext exprContext, org.w3c.dom.NodeList list)
           
XConnection(ExpressionContext exprContext, java.lang.String ConnPoolName)
           
XConnection(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL)
           
XConnection(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, org.w3c.dom.Element protocolElem)
           
XConnection(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
           
 
Method Summary
 void addParameter(java.lang.String value)
          Add an untyped value to the parameter list.
 void addParameterFromElement(org.w3c.dom.Element e)
          Add a single parameter to the parameter list formatted as an Element
 void addParameterFromElement(org.w3c.dom.NodeList nl)
          Add a section of parameters to the Parameter List Do each element from the list
 void addParameterWithType(java.lang.String value, java.lang.String Type)
          Add a typed parameter to the parameter list.
 void clearParameters()
           
 void close()
          Close the connection to the data source.
 void close(SQLDocument sqldoc)
          Close the connection to the data source.
 XBooleanStatic connect(ExpressionContext exprContext, org.w3c.dom.Element protocolElem)
           
 XBooleanStatic connect(ExpressionContext exprContext, org.w3c.dom.NodeList list)
           
 XBooleanStatic connect(ExpressionContext exprContext, java.lang.String ConnPoolName)
          Create an XConnection using the name of an existing Connection Pool
 XBooleanStatic connect(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL)
          Create an XConnection object with just a driver and database URL.
 XBooleanStatic connect(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, org.w3c.dom.Element protocolElem)
          Create an XConnection object with a connection protocol
 XBooleanStatic connect(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
          Create an XConnection object with user ID and password.
 void disableDefaultConnectionPool()
          See enableDefaultConnectionPool
 void disableStreamingMode()
          Control how the SQL Document uses memory.
 void enableDefaultConnectionPool()
          There is a problem with some JDBC drivers when a Connection is open and the JVM shutsdown.
 void enableStreamingMode()
          Control how the SQL Document uses memory.
protected  void finalize()
           
 weblogic.apache.xml.dtm.DTM getError()
          Provide access to the last error that occued.
 weblogic.apache.xml.dtm.DTM pquery(ExpressionContext exprContext, java.lang.String queryString)
          Execute a parameterized query statement by instantiating an
 weblogic.apache.xml.dtm.DTM pquery(ExpressionContext exprContext, java.lang.String queryString, java.lang.String typeInfo)
          Execute a parameterized query statement by instantiating an
 weblogic.apache.xml.dtm.DTM query(ExpressionContext exprContext, java.lang.String queryString)
          Execute a query statement by instantiating an
 void setParameter(int pos, java.sql.PreparedStatement stmt, QueryParameter p)
          Set the parameter for a Prepared Statement
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XConnection

public XConnection()

XConnection

public XConnection(ExpressionContext exprContext,
                   java.lang.String ConnPoolName)

Parameters:
exprContext -  
ConnPoolName -  

XConnection

public XConnection(ExpressionContext exprContext,
                   java.lang.String driver,
                   java.lang.String dbURL)

Parameters:
exprContext -  
driver -  
dbURL -  

XConnection

public XConnection(ExpressionContext exprContext,
                   org.w3c.dom.NodeList list)

Parameters:
exprContext -  
list -  

XConnection

public XConnection(ExpressionContext exprContext,
                   java.lang.String driver,
                   java.lang.String dbURL,
                   java.lang.String user,
                   java.lang.String password)

Parameters:
exprContext -  
driver -  
dbURL -  
user -  
password -  

XConnection

public XConnection(ExpressionContext exprContext,
                   java.lang.String driver,
                   java.lang.String dbURL,
                   org.w3c.dom.Element protocolElem)

Parameters:
exprContext -  
driver -  
dbURL -  
protocolElem -  
Method Detail

connect

public XBooleanStatic connect(ExpressionContext exprContext,
                              java.lang.String ConnPoolName)
Create an XConnection using the name of an existing Connection Pool

Parameters:
exprContext -  
ConnPoolName -  

connect

public XBooleanStatic connect(ExpressionContext exprContext,
                              java.lang.String driver,
                              java.lang.String dbURL)
Create an XConnection object with just a driver and database URL.

Parameters:
exprContext -  
driver - JDBC driver of the form foo.bar.Driver.
dbURL - database URL of the form jdbc:subprotocol:subname.

connect

public XBooleanStatic connect(ExpressionContext exprContext,
                              org.w3c.dom.Element protocolElem)

Parameters:
exprContext -  
protocolElem -  

connect

public XBooleanStatic connect(ExpressionContext exprContext,
                              org.w3c.dom.NodeList list)

Parameters:
exprContext -  
list -  

connect

public XBooleanStatic connect(ExpressionContext exprContext,
                              java.lang.String driver,
                              java.lang.String dbURL,
                              java.lang.String user,
                              java.lang.String password)
Create an XConnection object with user ID and password.

Parameters:
exprContext -  
driver - JDBC driver of the form foo.bar.Driver.
dbURL - database URL of the form jdbc:subprotocol:subname.
user - user ID.
password - connection password.

connect

public XBooleanStatic connect(ExpressionContext exprContext,
                              java.lang.String driver,
                              java.lang.String dbURL,
                              org.w3c.dom.Element protocolElem)
Create an XConnection object with a connection protocol

Parameters:
exprContext -  
driver - JDBC driver of the form foo.bar.Driver.
dbURL - database URL of the form jdbc:subprotocol:subname.
protocolElem - list of string tag/value connection arguments, normally including at least "user" and "password".

query

public weblogic.apache.xml.dtm.DTM query(ExpressionContext exprContext,
                                         java.lang.String queryString)
                                  throws java.sql.SQLException
Execute a query statement by instantiating an

Parameters:
exprContext -  
queryString - the SQL query.
Returns:
XStatement implements NodeIterator.
Throws:
java.sql.SQLException -  

pquery

public weblogic.apache.xml.dtm.DTM pquery(ExpressionContext exprContext,
                                          java.lang.String queryString)
                                   throws java.sql.SQLException
Execute a parameterized query statement by instantiating an

Parameters:
exprContext -  
queryString - the SQL query.
Returns:
XStatement implements NodeIterator.
Throws:
java.sql.SQLException -  

pquery

public weblogic.apache.xml.dtm.DTM pquery(ExpressionContext exprContext,
                                          java.lang.String queryString,
                                          java.lang.String typeInfo)
                                   throws java.sql.SQLException
Execute a parameterized query statement by instantiating an

Parameters:
exprContext -  
queryString - the SQL query.
typeInfo -  
Returns:
XStatement implements NodeIterator.
Throws:
java.sql.SQLException -  

addParameter

public void addParameter(java.lang.String value)
Add an untyped value to the parameter list.

Parameters:
value -  

addParameterWithType

public void addParameterWithType(java.lang.String value,
                                 java.lang.String Type)
Add a typed parameter to the parameter list.

Parameters:
value -  
Type -  

addParameterFromElement

public void addParameterFromElement(org.w3c.dom.Element e)
Add a single parameter to the parameter list formatted as an Element

Parameters:
e -  

addParameterFromElement

public void addParameterFromElement(org.w3c.dom.NodeList nl)
Add a section of parameters to the Parameter List Do each element from the list

Parameters:
nl -  

clearParameters

public void clearParameters()

enableDefaultConnectionPool

public void enableDefaultConnectionPool()
There is a problem with some JDBC drivers when a Connection is open and the JVM shutsdown. If there is a problem, there is no way to control the currently open connections in the pool. So for the default connection pool, the actuall pooling mechinsm is disabled by default. The Stylesheet designer can re-enabled pooling to take advantage of connection pools. The connection pool can even be disabled which will close all outstanding connections.

disableDefaultConnectionPool

public void disableDefaultConnectionPool()
See enableDefaultConnectionPool

enableStreamingMode

public void enableStreamingMode()
Control how the SQL Document uses memory. In Streaming Mode, memory consumption is greatly reduces so you can have queries of unlimited size but it will not let you traverse the data more than once.

disableStreamingMode

public void disableStreamingMode()
Control how the SQL Document uses memory. In Streaming Mode, memory consumption is greatly reduces so you can have queries of unlimited size but it will not let you traverse the data more than once.

getError

public weblogic.apache.xml.dtm.DTM getError()
Provide access to the last error that occued. This error may be over written when the next operation occurs.

close

public void close()
           throws java.sql.SQLException
Close the connection to the data source.

Throws:
java.sql.SQLException -  

close

public void close(SQLDocument sqldoc)
           throws java.sql.SQLException
Close the connection to the data source. Only close the connections for a single document.

Parameters:
sqldoc -  
Throws:
java.sql.SQLException -  

setParameter

public void setParameter(int pos,
                         java.sql.PreparedStatement stmt,
                         QueryParameter p)
                  throws java.sql.SQLException
Set the parameter for a Prepared Statement

Parameters:
pos -  
stmt -  
p -  
Throws:
java.sql.SQLException -  

finalize

protected void finalize()

Overrides:
finalize in class java.lang.Object

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference