|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.flyway.core.util.jdbc.DriverDataSource
public class DriverDataSource
YAGNI: The simplest DataSource implementation that works for Flyway.
| Constructor Summary | |
|---|---|
DriverDataSource()
Creates a new DriverDataSource. |
|
DriverDataSource(java.sql.Driver driver,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String... initSqls)
Creates a new DriverDataSource. |
|
DriverDataSource(java.lang.String driverClass,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String... initSqls)
Creates a new DriverDataSource. |
|
| Method Summary | ||
|---|---|---|
java.sql.Connection |
getConnection()
This implementation delegates to getConnectionFromDriver,
using the default user and password of this DataSource. |
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
This implementation delegates to getConnectionFromDriver,
using the given user and password. |
|
protected java.sql.Connection |
getConnectionFromDriver(java.lang.String username,
java.lang.String password)
Build properties for the Driver, including the given user and password (if any), and obtain a corresponding Connection. |
|
java.sql.Driver |
getDriver()
|
|
java.lang.String[] |
getInitSqls()
|
|
int |
getLoginTimeout()
|
|
java.io.PrintWriter |
getLogWriter()
|
|
java.lang.String |
getPassword()
|
|
java.lang.String |
getUrl()
|
|
java.lang.String |
getUser()
|
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
|
|
void |
setLoginTimeout(int timeout)
|
|
void |
setLogWriter(java.io.PrintWriter pw)
|
|
|
unwrap(java.lang.Class<T> iface)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DriverDataSource()
public DriverDataSource(java.sql.Driver driver,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String... initSqls)
throws FlywayException
driver - The JDBC Driver instance to use.url - The JDBC URL to use for connecting through the Driver.user - The JDBC user to use for connecting through the Driver.password - The JDBC password to use for connecting through the Driver.initSqls - The (optional) sql statements to execute to initialize a connection immediately after obtaining it.
FlywayException - when the datasource could not be created.
public DriverDataSource(java.lang.String driverClass,
java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String... initSqls)
throws FlywayException
driverClass - The name of the JDBC Driver class to use.url - The JDBC URL to use for connecting through the Driver.user - The JDBC user to use for connecting through the Driver.password - The JDBC password to use for connecting through the Driver.initSqls - The (optional) sql statements to execute to initialize a connection immediately after obtaining it.
FlywayException - when the datasource could not be created.| Method Detail |
|---|
public java.sql.Driver getDriver()
public java.lang.String getUrl()
public java.lang.String getUser()
public java.lang.String getPassword()
public java.lang.String[] getInitSqls()
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnectionFromDriver,
using the default user and password of this DataSource.
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptiongetConnectionFromDriver(String, String)
public java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnectionFromDriver,
using the given user and password.
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptiongetConnectionFromDriver(String, String)
protected java.sql.Connection getConnectionFromDriver(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
username - the name of the userpassword - the password to use
java.sql.SQLException - in case of failureDriver.connect(String, java.util.Properties)
public int getLoginTimeout()
throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLException
public void setLoginTimeout(int timeout)
throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
getLogWriter in interface javax.sql.CommonDataSource
public void setLogWriter(java.io.PrintWriter pw)
throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||