|
||||||||||
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
The XConnection Object is the main (currently the only) interface into the SQL Extensions from the Transformer. It is initiated by supplying connection information and is used by instructing it to produce a JDBC Query.
* The XConnection Object provides several methods of connecting to a JDBC Source. There are two major connection methods, one where the actual connection is established outside the scope of the trasformerXConnectionPoolManager
and the other
where the Connection information is supplied as part or either the
XSLT Stylesheet or the XML Document.
If the Connection is part of an external connection, the connection is identified just by its connection pool name. In this mode, the connection pool manager will be interogated for the connection pool instance and a new connection is pulled from there.
When the Connection information is supplied from the Stylesheet or Document, the minimal amount of information that needs to be supplied is the JDBC class or driver and the URL to connect to that Driver.
Top maintain backward compatibility with previous versions of the extension, supplying connection information in the constructor is still supported.The new method is to supply the connection information via the connect method.
Once a connection is established, a Database query must be performed to have data to work with. This can be accomplished in one of two way.
The straight query; the query method allow a simple query to be excuted. This methode qucikly becomes cumbersome when parts of the query are being created dynamically as part of the data but is easiest to implement for a simple static query.
The parameter based query; the pquery method allows the Stylesheet designer to create a simple query with place markers for the dynamic components. Form there the parameters are added in order. The pquery uses the JDBC prepated statement to do its work. Parmateres also allow the Stylesheet designer to specify the parameter type.
Field Summary | |
java.sql.Connection |
m_connection
The JDBC connection. |
Constructor Summary | |
XConnection(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,
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(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()
Clear the parameter list for the Prameter based queries. |
void |
close()
Close the connection to the data source. |
NodeIterator |
connect(Element protocolElem)
|
NodeIterator |
connect(NodeList list)
|
NodeIterator |
connect(java.lang.String ConnPoolName)
Create an XConnection using the name of an existing Connection Pool |
NodeIterator |
connect(java.lang.String driver,
java.lang.String dbURL)
Create an XConnection object with just a driver and database URL. |
NodeIterator |
connect(java.lang.String driver,
java.lang.String dbURL,
Element protocolElem)
Create an XConnection object with a connection protocol |
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 |
disableCacheNodes()
|
void |
disableDefaultConnectionPool()
See enableDefaultConnectionPool |
void |
enableCacheNodes()
|
void |
enableDefaultConnectionPool()
There is a problem with some JDBC drivers when a Connection is open and the JVM shutsdown. |
NodeIterator |
pquery(java.lang.String queryString)
Execute a parameterized query statement by instantiating an XStatement object. |
NodeIterator |
pquery(java.lang.String queryString,
java.lang.String typeInfo)
Execute a parameterized query statement by instantiating an XStatement object. |
NodeIterator |
query(java.lang.String queryString)
Execute a query statement by instantiating an XStatement object. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public java.sql.Connection m_connection
Constructor Detail |
public XConnection(java.lang.String ConnPoolName)
public XConnection(java.lang.String driver, java.lang.String dbURL)
public XConnection(NodeList list)
public XConnection(java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
public XConnection(java.lang.String driver, java.lang.String dbURL, Element protocolElem)
Method Detail |
public NodeIterator connect(java.lang.String ConnPoolName)
String
- poolName
, name of the existing pool
to pull connections from.public NodeIterator connect(java.lang.String driver, java.lang.String dbURL)
driver
- JDBC driver of the form foo.bar.Driver.dbURL
- database URL of the form jdbc:subprotocol:subname.public NodeIterator connect(Element protocolElem)
public NodeIterator connect(NodeList list)
public NodeIterator connect(java.lang.String driver, java.lang.String dbURL, java.lang.String user, java.lang.String password)
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 NodeIterator connect(java.lang.String driver, java.lang.String dbURL, Element protocolElem)
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 NodeIterator query(java.lang.String queryString)
queryString
- the SQL query.public NodeIterator pquery(java.lang.String queryString)
queryString
- the SQL query.public NodeIterator pquery(java.lang.String queryString, java.lang.String typeInfo)
queryString
- the SQL query.public void addParameter(java.lang.String value)
public void addParameterWithType(java.lang.String value, java.lang.String Type)
public void addParameterFromElement(Element e)
public void addParameterFromElement(NodeList nl)
public void enableDefaultConnectionPool()
public void disableDefaultConnectionPool()
public void clearParameters()
public void close() throws java.sql.SQLException
public void enableCacheNodes()
public void disableCacheNodes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |