public final class OXQDataSource extends java.lang.Object implements XQDataSource
javax.xml.xquery.XQDataSource
.XQDataSource
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEBUG_MODE
A property that when set to
"true" , debugging will be enabled; otherwise, debugging
will be disabled. |
static java.lang.String |
DISABLE_EXPRESSION_TRACKING
A property that when set to
"true" will
prevent a connection from tracking open expressions that
are created from it. |
static java.lang.String |
DOM_PASS_THROUGH
A property that when set to
"true" relaxes XML data model conversions. |
static java.lang.String |
IMPORT_SHARING
A property that when set to
"true" , schema and module imports will be shared among
queries from the same connection. |
static java.lang.String |
PESSIMISTIC_TYPE_CHECKING
A property that determines if optimistic
or pessimistic type checking will be used at compile time.
|
static java.lang.String |
USE_EXTERNAL_STORAGE
A property that when set to
"true" will
cause the query processor use an instance of oracle.xml.scalable.PageManager
when materializing XML. |
Constructor and Description |
---|
OXQDataSource()
Constructs a data source with default properties.
|
OXQDataSource(java.util.Properties inProperties)
Constructs a data source with the specified properties.
|
Modifier and Type | Method and Description |
---|---|
XQConnection |
getConnection()
Attempts to create a connection to an XML datasource.
|
XQConnection |
getConnection(java.sql.Connection con)
Attempts to create a connection to an XML datasource using an
existing JDBC connection.
|
XQConnection |
getConnection(java.lang.String username,
java.lang.String passwd)
Attempts to establish a connection to an XML datasource using the
supplied username and password.
|
int |
getLoginTimeout()
Gets the maximum time in seconds that this datasource can wait while
attempting to connect to a database.
|
java.io.PrintWriter |
getLogWriter()
Retrieves the log writer for this
XQDataSource object. |
java.lang.String |
getProperty(java.lang.String name)
Returns the current value of the named property if set, else
null . |
java.lang.String[] |
getSupportedPropertyNames()
Returns an array containing the property names supported by this
XQDataSource . |
void |
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this datasource will wait while
attempting to connect to a database.
|
void |
setLogWriter(java.io.PrintWriter out)
Sets the log writer for this
XQDataSource object to the given
java.io.PrintWriter object. |
void |
setProperties(java.util.Properties props)
Sets the data source properties from the specified
Properties
instance. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets the named property to the specified value.
|
public static final java.lang.String PESSIMISTIC_TYPE_CHECKING
When set to "true"
, pessimistic type checking will be used. For any other
value, optimistic type checking will be used. The default value is "false"
.
public static final java.lang.String DEBUG_MODE
"true"
, debugging will be enabled; otherwise, debugging
will be disabled. The default value of this property is "false"
public static final java.lang.String IMPORT_SHARING
"true"
, schema and module imports will be shared among
queries from the same connection. The default value of this property
is "false"
public static final java.lang.String DOM_PASS_THROUGH
"true"
relaxes XML data model conversions.
XQuery is designed to process instances of the XQuery and XPath data
model (XDM). In several places, the XQJ API facilitates consuming XDM as DOM.
For example, XQItemAccessor.getNode()
returns the XDM node as a DOM node. The conversion from XDM to DOM is
specified in two parts: XDM Infoset
Mapping and Appendix C of the DOM specification.
When the input data to the
query is DOM and the output of the query is consumed as DOM, it may be
desirable to avoid the required data model conversions to
improve performance. When this this property is set to
"true"
DOM may be queried directly without conversion. Note,
the processor can not conform strictly to the specifications when in this
mode. For example, CDATA nodes, adjacent text nodes, empty text nodes,
entity reference nodes, and document type nodes may all appear in the result.
The default value of this property is "false"
.
public static final java.lang.String USE_EXTERNAL_STORAGE
"true"
will
cause the query processor use an instance of oracle.xml.scalable.PageManager
when materializing XML. There are two scenarios in which the
PageManager
may be used:
BINDING_MODE_IMMEDIATE
, then the
bound value will be copied into the PageManager
. In this case,
all pages will be released (deleted) by the time the corresponding
XQPreparedExpression
or XQExpression
is closed.PageManager
. In this
case, all pages will be released (deleted) by the time the corresponding
XQResultSequence
is closed.OXQDynamicContext.setPageManager(oracle.xml.scalable.PageManager)
Using external storage may drastically reduce the main memory needed to
process a query but it may also make query processing take longer.public static final java.lang.String DISABLE_EXPRESSION_TRACKING
"true"
will
prevent a connection from tracking open expressions that
are created from it. This is intended for use in cases where
multiple threads access the connection and the synchronization
needed to track open expressions causes performance
problems. When expression tracking is disabled, an attempt to call
XQConnection.close()
will raise an
error so this can only be used in cases where relying on
the connection to close expressions is not needed.public OXQDataSource()
public OXQDataSource(java.util.Properties inProperties) throws XQException
inProperties
- the data source properties, may not be null
XQException
- if inProperties
is null
or if a given property is not supportedpublic XQConnection getConnection() throws XQException
getConnection
in interface XQDataSource
XQException
- if a datasource access error occurspublic XQConnection getConnection(java.sql.Connection con) throws XQException
XQException
)
is thrown. The XQJ and JDBC connections will operate under the same
transaction context.getConnection
in interface XQDataSource
con
- an existing JDBC connectionXQException
- if (1) a datasource access error occurs,
(2) the implementation does not support
this method of getting an
XQConnection
, or (3) if
the con
parameter is null
public XQConnection getConnection(java.lang.String username, java.lang.String passwd) throws XQException
getConnection
in interface XQDataSource
username
- the user on whose behalf the connection
is being madepasswd
- the user's passwordXQException
- if a datasource access error occurspublic void setLoginTimeout(int seconds) throws XQException
XQDataSource
object is created, the login timeout is initially zero.
It is implementation-defined whether the specified login timeout is
actually used by the data source implementation. If the connection is
created over an existing JDBC connection, then the login timeout
value from the underlying JDBC connection may be used.setLoginTimeout
in interface XQDataSource
seconds
- the datasource login time limitXQException
- if a datasource access error occurspublic int getLoginTimeout() throws XQException
getLoginTimeout
in interface XQDataSource
XQException
- if a datasource access error occurspublic void setLogWriter(java.io.PrintWriter out) throws XQException
XQDataSource
object to the given
java.io.PrintWriter
object. The log writer is a character output
stream to which all logging and tracing messages for this datasource
will be printed. This includes messages printed by the methods of this
object, messages printed by methods of other objects manufactured by
this object, and so on. When a XQDataSource
object is created
the log writer is initially null
; in other words, the default
is for logging to be disabled.setLogWriter
in interface XQDataSource
out
- the new log writer; to disable logging, set to
null
XQException
- if a datasource access error occurspublic java.io.PrintWriter getLogWriter() throws XQException
XQDataSource
object.
The log writer is a character output stream to which all logging and
tracing messages for this datasource will be printed. This includes
messages printed by the methods of this object, messages printed by
methods of other objects manufactured by this object, and so on.
When a XQDataSource
object is created, the log writer is
initially null
; in other words, the default is for logging
to be disabled.getLogWriter
in interface XQDataSource
null
if logging is disabledXQException
- if a datasource access error occurspublic java.lang.String[] getSupportedPropertyNames()
XQDataSource
.
Implementations that support user name and password must recognize
the user name and password properties listed below.
user |
the user name to use for creating a connection |
password |
the password to use for creating a connection |
getSupportedPropertyNames
in interface XQDataSource
String[]
an array of property names
supported by this implementationpublic void setProperty(java.lang.String name, java.lang.String value) throws XQException
If the implementation does not support the given property or if it can determine that the value given for this property is invalid, then an exception is thrown. If an exception is thrown, then no previous value is overwritten.
setProperty
in interface XQDataSource
name
- the name of the property to setvalue
- the value of the named propertyXQException
- if (1) the given property is not recognized,
(2) the value for the given property is
determined to be invalid, or (3) the name
parameter is null
public java.lang.String getProperty(java.lang.String name) throws XQException
null
. If the implementation does not support the
given property then an exception is raised.getProperty
in interface XQDataSource
name
- the name of the property whose value is
neededString
representing the value of
the required property if set, else
null
XQException
- if (1) a given property is not supported, or
(2) the name parameter is null
public void setProperties(java.util.Properties props) throws XQException
Properties
instance. Properties set before this call will still apply but
those with the same name as any of these properties will be replaced.
Properties set after this call also apply and may
replace properties set during this call.If the implementation does not support one or more of the given property names, or if it can determine that the value given for a specific property is invalid, then an exception is thrown. If an exception is thrown, then no previous value is overwritten. is invalid, then an exception is raised.
setProperties
in interface XQDataSource
props
- the list of properties to setXQException
- if (1) a given property is not recognized,
(2) the value for a given property is
determined to be invalid, or (3) the
props
parameter is null
Copyright © 2020, 2024, Oracle and/or its affiliates.