java.lang.AutoCloseable
public interface DataSource
extends java.lang.AutoCloseable
Session
. A getSession()
method is provided as a convenience.
Implementations must be thread safe.Modifier and Type | Interface | Description |
---|---|---|
static interface |
DataSource.Builder |
Instances of this type are used to build
DataSource s. |
Modifier and Type | Method | Description |
---|---|---|
Session.Builder |
builder() |
Returns a
Session builder. |
void |
close() |
|
default Session |
getSession() |
|
default Session |
getSession(java.util.function.Consumer<java.lang.Throwable> handler) |
|
default java.util.List<java.lang.String> |
supportedTranslateSqlFormats() |
Return a list of the source formats accepted by the
translateSql(java.lang.String,java.lang.String) method. |
default java.lang.String |
translateSql(java.lang.String format,
java.lang.String source) |
Translates a SQL string from the format specified by the format argument
to a format that can be used to create
Operation s for the Session s
provided by this DataSource . |
Session.Builder builder()
Session
builder. By default that builder will return
Session
s with the SessionProperty
s specified when creating this
DataSource. Default and unspecified SessionProperty
s can be set with
the returned builder.Session
builder. Not null
.java.lang.IllegalStateException
- if this DataSource
is closeddefault Session getSession()
Session
that has a submitted attach Operation
. Convenience
method for use with try with resources.Session
java.lang.IllegalStateException
- if this DataSource
is closeddefault Session getSession(java.util.function.Consumer<java.lang.Throwable> handler)
Session
that has a submitted attach Operation
with an error
handler. Convenience method for use with try with resources. The error
handle handles errors in the attach Operation
.handler
- for errors in the attach Operation
Session
java.lang.IllegalStateException
- if this DataSource
is closeddefault java.lang.String translateSql(java.lang.String format, java.lang.String source) throws SqlException
Operation
s for the Session
s
provided by this DataSource
.
ISSUE: Just an ideaformat
- not null
source
- SQL in the format specified by format
. Not null
.DataSource
. Not null
.java.lang.IllegalArgumentException
- if the format
is not supported or
if the DataSource
cannot translate the SQLjava.lang.IllegalStateException
- if this DataSource
is closedSqlException
default java.util.List<java.lang.String> supportedTranslateSqlFormats()
translateSql(java.lang.String,java.lang.String)
method.
ISSUE: Just an ideajava.lang.IllegalStateException
- if this DataSource
is closedvoid close()
close
in interface java.lang.AutoCloseable
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2017, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
DRAFT JDBC 4.4 EA5