public class SimpleDataSource
extends java.lang.Object
implements javax.sql.DataSource
| Modifier and Type | Field and Description |
|---|---|
protected java.sql.Driver |
driver
JDBCドライバ
|
protected java.lang.String |
password
データベースの接続パスワードです。
|
protected java.util.Properties |
properties
JDBCドライバへのプロパティです。
|
protected static java.lang.String |
UNABLE_TO_ESTABLISH_CONNECTION
コネクションが確立できない場合の
SQLState コードです。 |
protected java.lang.String |
url
jdbc:subprotocol:subnameという形式のデータベースへの接続URLです。 |
protected java.lang.String |
user
データベースの接続ユーザーです。
|
| Constructor and Description |
|---|
SimpleDataSource() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProperty(java.lang.String key,
java.lang.String value)
JDBCドライバへのプロパティを追加します。
|
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password) |
protected java.sql.Connection |
getConnectionInternal(java.util.Properties info)
内部的にコネクションを返します。
|
java.sql.Driver |
getDriver()
JDBCドライバを返します。
|
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
java.lang.String |
getPassword()
データベースの接続パスワードを返します。
|
java.lang.String |
getUrl()
データベースへの接続URLを返します。
|
java.lang.String |
getUser()
データベースの接続ユーザーを返します。
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setDriver(java.sql.Driver driver)
JDBCドライバを設定します。
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
void |
setPassword(java.lang.String password)
データベースの接続パスワードを設定します。
|
void |
setUrl(java.lang.String url)
データベースの接続URLを設定します。
|
void |
setUser(java.lang.String user)
データベースの接続ユーザーを設定します。
|
<T> T |
unwrap(java.lang.Class<T> iface) |
protected static final java.lang.String UNABLE_TO_ESTABLISH_CONNECTION
SQLState コードです。protected java.sql.Driver driver
protected java.lang.String url
jdbc:subprotocol:subnameという形式のデータベースへの接続URLです。protected java.lang.String user
protected java.lang.String password
protected final java.util.Properties properties
public java.sql.Driver getDriver()
public void setDriver(java.sql.Driver driver)
driver - JDBCドライバpublic java.lang.String getUrl()
public void setUrl(java.lang.String url)
url - jdbc:subprotocol:subnameという形式のデータベースへの接続URLpublic java.lang.String getUser()
public void setUser(java.lang.String user)
user - データベースの接続ユーザーpublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
password - データベースの接続パスワードpublic void addProperty(java.lang.String key,
java.lang.String value)
key - プロパティのキーvalue - プロパティの値public int getLoginTimeout()
getLoginTimeout in interface javax.sql.CommonDataSourcepublic void setLoginTimeout(int seconds)
setLoginTimeout in interface javax.sql.CommonDataSourcepublic java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String user,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionprotected java.sql.Connection getConnectionInternal(java.util.Properties info)
throws java.sql.SQLException
info - JDBCドライバへのプロパティjava.sql.SQLException - SQLに関する例外が発生した場合public java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedException