java.lang.AutoCloseable
public interface DataSource
extends java.lang.AutoCloseable
Connection
. A getConnection()
method is provided as a convenience.Modifier and Type | Interface | Description |
---|---|---|
static interface |
DataSource.Builder |
Instances of this type are used to build
DataSource s. |
Modifier and Type | Method | Description |
---|---|---|
Connection.Builder |
builder() |
Returns a
Connection builder. |
void |
close() |
|
default Connection |
getConnection() |
Returns a
Connection that has a submitted connect Operation . |
default Connection |
getConnection(java.util.function.Consumer<java.lang.Throwable> handler) |
Returns a
Connection that has a submitted connect Operation with an error
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 Connection s
provided by this DataSource . |
Connection.Builder builder()
Connection
builder. By default that builder will return
Connection
s with the ConnectionProperty
s specified when creating this
DataSource. Default and unspecified ConnectionProperty
s can be set with
the returned builder.Connection
builder. Not null
.default Connection getConnection()
Connection
that has a submitted connect Operation
. Convenience
method for use with try with resources.Connection
default Connection getConnection(java.util.function.Consumer<java.lang.Throwable> handler)
Connection
that has a submitted connect Operation
with an error
handler. Convenience method for use with try with resources. The error
handle handles errors in the connect Operation
.handler
- for errors in the connect Operation
Connection
default java.lang.String translateSql(java.lang.String format, java.lang.String source) throws SqlException
Operation
s for the Connection
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 supportedSqlException
- if the DataSource
cannot translate the SQLdefault java.util.List<java.lang.String> supportedTranslateSqlFormats()
translateSql(java.lang.String,java.lang.String)
method.
ISSUE: Just an ideavoid 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 EA