Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.xalan.lib.sql.XConnection
public class XConnection
extends java.lang.Object
xmlns:sql="http://xml.apache.org/xalan/sql"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.
Constructor Summary | |
| |
| |
| |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
XBooleanStatic |
|
XBooleanStatic |
|
XBooleanStatic |
|
XBooleanStatic |
|
XBooleanStatic |
|
XBooleanStatic |
|
void |
|
void |
|
void |
|
void |
|
ConnectionPool |
|
DTM |
|
String |
|
DTM |
|
DTM |
|
DTM |
|
void |
|
void |
|
void |
|
public XConnection()
public XConnection(ExpressionContext exprContext, String ConnPoolName)
- Parameters:
exprContext
-ConnPoolName
-
public XConnection(ExpressionContext exprContext, String driver, String dbURL)
- Parameters:
exprContext
-driver
-dbURL
-
public XConnection(ExpressionContext exprContext, String driver, String dbURL, String user, String password)
- Parameters:
exprContext
-driver
-dbURL
-user
-password
-
public XConnection(ExpressionContext exprContext, String driver, String dbURL, Element protocolElem)
- Parameters:
exprContext
-driver
-dbURL
-protocolElem
-
public XConnection(ExpressionContext exprContext, NodeList list)
- Parameters:
exprContext
-list
-
public void addParameter(String value)
Add an untyped value to the parameter list.
- Parameters:
value
-
public void addParameterFromElement(Element e)
Add a single parameter to the parameter list formatted as an Element
- Parameters:
e
-
public void addParameterFromElement(NodeList nl)
Add a section of parameters to the Parameter List Do each element from the list
- Parameters:
nl
-
public void addParameterWithType(String value, String Type)
Add a typed parameter to the parameter list.
- Parameters:
value
-Type
-
public void clearParameters()
public void close() throws SQLException
Close the connection to the data source.
public void close(SQLDocument sqldoc) throws SQLException
Close the connection to the data source. Only close the connections for a single document.
- Parameters:
sqldoc
-
public XBooleanStatic connect(ExpressionContext exprContext, String ConnPoolName)
Create an XConnection using the name of an existing Connection Pool
- Parameters:
exprContext
-ConnPoolName
-
public XBooleanStatic connect(ExpressionContext exprContext, String driver, 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.
public XBooleanStatic connect(ExpressionContext exprContext, String driver, String dbURL, String user, 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.
public XBooleanStatic connect(ExpressionContext exprContext, String driver, String dbURL, 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".
public XBooleanStatic connect(ExpressionContext exprContext, Element protocolElem)
- Parameters:
exprContext
-protocolElem
-
public XBooleanStatic connect(ExpressionContext exprContext, NodeList list)
- Parameters:
exprContext
-list
-
public void disableDefaultConnectionPool()
Deprecated. Use setFeature("default-pool-enabled", "false");
See enableDefaultConnectionPool
public void disableStreamingMode()
Deprecated. Use setFeature("streaming", "false");
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.
public void enableDefaultConnectionPool()
Deprecated. Use setFeature("default-pool-enabled", "true");
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.
public void enableStreamingMode()
Deprecated. Use setFeature("streaming", "true");
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.
public ConnectionPool getConnectionPool()
Allow the SQL Document to retrive a connection to be used to build the SQL Statement.
public DTM getError()
Provide access to the last error that occued. This error may be over written when the next operation occurs.
public String getFeature(String feature)
Get feature options for this XConnection.
- Parameters:
feature
- The name of the feature to get the setting for.
- Returns:
- The setting of the specified feature. Will be "true" or "false" (null if the feature is not known)
public DTM pquery(ExpressionContext exprContext, String queryString)
Execute a parameterized query statement by instantiating anXStatement} object. The XStatement executes the query, and uses the result set to create a
RowSet}, a row-set element.
- Parameters:
exprContext
-queryString
- the SQL query.
- Returns:
- XStatement implements NodeIterator.
public DTM pquery(ExpressionContext exprContext, String queryString, String typeInfo)
Execute a parameterized query statement by instantiating anXStatement} 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:
exprContext
-queryString
- the SQL query.typeInfo
-
- Returns:
- XStatement implements NodeIterator.
public DTM query(ExpressionContext exprContext, String queryString)
Execute a query statement by instantiating anXStatement} object. The XStatement executes the query, and uses the result set to create a
RowSet}, a row-set element.
- Parameters:
exprContext
-queryString
- the SQL query.
- Returns:
- XStatement implements NodeIterator.
public void setError(Exception excp, ExpressionContext expr)
This is an internal version of Set Error that is called withen XConnection where there is no SQLDocument created yet. As in the Connect statement or creation of the ConnectionPool.
public void setError(Exception excp, SQLDocument doc, SQLWarning warn)
Set an error and/or warning on this connection.
- Parameters:
public void setFeature(String feature, String setting)
Set feature options for this XConnection.
- Parameters:
feature
- The name of the feature being set, currently supports (streaming, inline-variables, multiple-results, cache-statements, default-pool-enabled).setting
- The new setting for the specified feature, currently "true" is true and anything else is false.