|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xalan.lib.sql.XConnection
An XSLT extension that allows a stylesheet to access JDBC data. It is accessed by specifying a namespace URI as follows:
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 | |
XConnection()
|
|
XConnection(ExpressionContext exprContext,
NodeList list)
|
|
XConnection(ExpressionContext exprContext,
java.lang.String connPoolName)
Constructs a new XConnection and attempts to connect to a datasource as defined in the connect(ExpressionContext exprContext, String connPoolName)
method. |
|
XConnection(ExpressionContext exprContext,
java.lang.String driver,
java.lang.String dbURL)
|
|
XConnection(ExpressionContext exprContext,
java.lang.String driver,
java.lang.String dbURL,
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(Element e)
Add a single parameter to the parameter list formatted as an Element |
void |
addParameterFromElement(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(ExpressionContext exprContext,
java.lang.Object doc)
Close the connection to the data source. |
XBooleanStatic |
connect(ExpressionContext exprContext,
Element protocolElem)
|
XBooleanStatic |
connect(ExpressionContext exprContext,
NodeList list)
|
XBooleanStatic |
connect(ExpressionContext exprContext,
java.lang.String name)
Returns an XConnection from either a user created org.apache.xalan.lib.sql.ConnectionPool or a JNDI datasource. |
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,
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()
Deprecated. Use setFeature("default-pool-enabled", "false"); |
void |
disableStreamingMode()
Deprecated. Use setFeature("streaming", "false"); |
void |
enableDefaultConnectionPool()
Deprecated. Use setFeature("default-pool-enabled", "true"); |
void |
enableStreamingMode()
Deprecated. Use setFeature("streaming", "true"); |
ConnectionPool |
getConnectionPool()
Allow the SQL Document to retrive a connection to be used to build the SQL Statement. |
DTM |
getError()
Provide access to the last error that occued. |
java.lang.String |
getFeature(java.lang.String feature)
Get feature options for this XConnection. |
DTM |
pquery(ExpressionContext exprContext,
java.lang.String queryString)
Execute a parameterized query statement by instantiating an |
DTM |
pquery(ExpressionContext exprContext,
java.lang.String queryString,
java.lang.String typeInfo)
Execute a parameterized query statement by instantiating an |
DTM |
query(ExpressionContext exprContext,
java.lang.String queryString)
Execute a query statement by instantiating an |
void |
setError(java.lang.Exception excp,
ExpressionContext expr)
This is an internal version of Set Error that is called withen XConnection where there is no SQLDocument created yet. |
void |
setError(java.lang.Exception excp,
SQLDocument doc,
java.sql.SQLWarning warn)
Set an error and/or warning on this connection. |
void |
setFeature(java.lang.String feature,
java.lang.String setting)
Set feature options for this XConnection. |
void |
skipRec(ExpressionContext exprContext,
java.lang.Object o,
int value)
The purpose of this routine is to force the DB cursor to skip forward N records. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public XConnection()
public XConnection(ExpressionContext exprContext, java.lang.String connPoolName)
connect(ExpressionContext exprContext, String connPoolName)
method.
org.apache.xalan.lib.sql.ConnectionPool
or a JNDI datasource.exprContext
- Context automatically passed from the XSLT sheet.name
- The name of the ConnectionPool or the JNDI DataSource path.public XConnection(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL)
exprContext
- driver
- dbURL
- public XConnection(ExpressionContext exprContext, NodeList list)
exprContext
- list
- public XConnection(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
exprContext
- driver
- dbURL
- user
- password
- public XConnection(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, Element protocolElem)
exprContext
- driver
- dbURL
- protocolElem
- Method Detail |
public XBooleanStatic connect(ExpressionContext exprContext, java.lang.String name)
org.apache.xalan.lib.sql.ConnectionPool
or a JNDI datasource.
This method first tries to resolve the passed name against
ConnectionPool
s registered with
ConnectionPoolManager
.
If that fails, it attempts to find the name as a JNDI DataSource path.exprContext
- Context automatically passed from the XSLT sheet.name
- The name of the ConnectionPool or the JNDI DataSource path.public XBooleanStatic connect(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL)
exprContext
- driver
- JDBC driver of the form foo.bar.Driver.dbURL
- database URL of the form jdbc:subprotocol:subname.public XBooleanStatic connect(ExpressionContext exprContext, Element protocolElem)
exprContext
- protocolElem
- public XBooleanStatic connect(ExpressionContext exprContext, NodeList list)
exprContext
- list
- public XBooleanStatic connect(ExpressionContext exprContext, java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
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, java.lang.String driver, java.lang.String dbURL, Element protocolElem)
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 ConnectionPool getConnectionPool()
public DTM query(ExpressionContext exprContext, java.lang.String queryString)
exprContext
- queryString
- the SQL query.public DTM pquery(ExpressionContext exprContext, java.lang.String queryString)
exprContext
- queryString
- the SQL query.public DTM pquery(ExpressionContext exprContext, java.lang.String queryString, java.lang.String typeInfo)
exprContext
- queryString
- the SQL query.typeInfo
- public void skipRec(ExpressionContext exprContext, java.lang.Object o, int value)
exprContext
- o
- value
- public void addParameter(java.lang.String value)
value
- public void addParameterWithType(java.lang.String value, java.lang.String Type)
value
- Type
- public void addParameterFromElement(Element e)
e
- public void addParameterFromElement(NodeList nl)
nl
- public void clearParameters()
public void enableDefaultConnectionPool()
public void disableDefaultConnectionPool()
public void enableStreamingMode()
public void disableStreamingMode()
public DTM getError()
public void close() throws java.sql.SQLException
public void close(ExpressionContext exprContext, java.lang.Object doc) throws java.sql.SQLException
public void setError(java.lang.Exception excp, ExpressionContext expr)
public void setError(java.lang.Exception excp, SQLDocument doc, java.sql.SQLWarning warn)
public void setFeature(java.lang.String feature, java.lang.String setting)
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.public java.lang.String getFeature(java.lang.String feature)
feature
- The name of the feature to get the setting for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |