BEA Systems, Inc.

WebLogic Server 6.1 API Reference

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.


Field Summary
 java.sql.Connection m_connection
          The JDBC connection.
 java.util.Vector m_ParameterList
          For PreparedStatements, we need a place to to store the parameters in a vector.
 
Constructor Summary
XConnection(org.w3c.dom.NodeList list)
           
XConnection(java.lang.String ConnPoolName)
           
XConnection(java.lang.String driver, java.lang.String dbURL)
           
XConnection(java.lang.String driver, java.lang.String dbURL, org.w3c.dom.Element protocolElem)
           
XConnection(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 close()
          Close the connection to the data source.
 org.w3c.dom.traversal.NodeIterator connect(org.w3c.dom.Element protocolElem)
           
 org.w3c.dom.traversal.NodeIterator connect(org.w3c.dom.NodeList list)
           
 org.w3c.dom.traversal.NodeIterator connect(java.lang.String ConnPoolName)
          Create an XConnection using the name of an existing Connection Pool
 org.w3c.dom.traversal.NodeIterator connect(java.lang.String driver, java.lang.String dbURL)
          Create an XConnection object with just a driver and database URL.
 org.w3c.dom.traversal.NodeIterator connect(java.lang.String driver, java.lang.String dbURL, org.w3c.dom.Element protocolElem)
          Create an XConnection object with a connection protocol
 org.w3c.dom.traversal.NodeIterator connect(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 enableDefaultConnectionPool()
          There is a problem with some JDBC drivers when a Connection is open and the JVM shutsdown.
protected  void finalize()
           
 org.w3c.dom.traversal.NodeIterator pquery(java.lang.String queryString)
          Execute a parameterized query statement by instantiating an XStatement object.
 org.w3c.dom.traversal.NodeIterator pquery(java.lang.String queryString, java.lang.String typeInfo)
          Execute a parameterized query statement by instantiating an XStatement object.
 org.w3c.dom.traversal.NodeIterator query(java.lang.String queryString)
          Execute a query statement by instantiating an XStatement object.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_connection

public java.sql.Connection m_connection
The JDBC connection.

m_ParameterList

public java.util.Vector m_ParameterList
For PreparedStatements, we need a place to to store the parameters in a vector.
Constructor Detail

XConnection

public XConnection(java.lang.String ConnPoolName)

XConnection

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

XConnection

public XConnection(org.w3c.dom.NodeList list)

XConnection

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

XConnection

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

connect

public org.w3c.dom.traversal.NodeIterator connect(java.lang.String ConnPoolName)
Create an XConnection using the name of an existing Connection Pool

Parameters:
String - poolName, name of the existing pool to pull connections from.

connect

public org.w3c.dom.traversal.NodeIterator connect(java.lang.String driver,
                                                  java.lang.String dbURL)
Create an XConnection object with just a driver and database URL.

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

connect

public org.w3c.dom.traversal.NodeIterator connect(org.w3c.dom.Element protocolElem)

connect

public org.w3c.dom.traversal.NodeIterator connect(org.w3c.dom.NodeList list)

connect

public org.w3c.dom.traversal.NodeIterator connect(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:
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 org.w3c.dom.traversal.NodeIterator connect(java.lang.String driver,
                                                  java.lang.String dbURL,
                                                  org.w3c.dom.Element protocolElem)
Create an XConnection object with a connection protocol

Parameters:
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 org.w3c.dom.traversal.NodeIterator query(java.lang.String queryString)
Execute a query statement by instantiating an XStatement object. The XStatement executes the query, and uses the result set to create a RowSet, a row-set element.

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

pquery

public org.w3c.dom.traversal.NodeIterator pquery(java.lang.String queryString)
Execute a parameterized query statement by instantiating an XStatement object. The XStatement executes the query, and uses the result set to create a RowSet, a row-set element.

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

pquery

public org.w3c.dom.traversal.NodeIterator pquery(java.lang.String queryString,
                                                 java.lang.String typeInfo)
Execute a parameterized query statement by instantiating an XStatement object. The XStatement executes the query, and uses the result set to create a RowSet, a row-set element. This method allows for the user to pass in a comma seperated String that represents a list of parameter types. If supplied the parameter types will be used to overload the current types in the current parameter list.

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

addParameter

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

addParameterWithType

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

addParameterFromElement

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

addParameterFromElement

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

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

close

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

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/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.