Class JdbcDataSource
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.jdbcLoader.JdbcDataSource
-
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
public class JdbcDataSource extends Object implements DataSource
A trivial jdbc data source. Provides with pure jdbc connections.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONNECTION_ATTEMPTS_PROPERTYThe name of the internal property holding the number of connection attempts.protected PrintWritermyLogWriter
-
Constructor Summary
Constructors Constructor Description JdbcDataSource(JdbcDrivers drivers, String connectionUrl, Properties connectionInfo, String driverClassName, SQLDialect dialect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectiongetConnection()ConnectiongetConnection(String username, String password)PropertiesgetConnectionProperties()DrivergetDriver()intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()VersiongetVersion()booleanisWrapperFor(Class<?> iface)voidsetLoginTimeout(int seconds)voidsetLogWriter(PrintWriter out)<T> Tunwrap(Class<T> iface)
-
-
-
Field Detail
-
CONNECTION_ATTEMPTS_PROPERTY
public static final String CONNECTION_ATTEMPTS_PROPERTY
The name of the internal property holding the number of connection attempts.
- Since:
- 10.0.3
- See Also:
- TW-47479, Constant Field Values
-
myLogWriter
protected PrintWriter myLogWriter
-
-
Constructor Detail
-
JdbcDataSource
public JdbcDataSource(@NotNull JdbcDrivers drivers, @NotNull String connectionUrl, @NotNull Properties connectionInfo, @Nullable String driverClassName, @NotNull SQLDialect dialect) throws NoSuitableJdbcDrivers- Throws:
NoSuitableJdbcDrivers
-
-
Method Detail
-
getVersion
@NotNull public Version getVersion()
-
getDriver
@NotNull public Driver getDriver()
-
getConnection
@NotNull public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
NativeDatabaseDriverIsNotAccessibleException- if the driver fails to load a native library (Oracle OCI and MS SQL Server).IllegalStateException- if theDriver.connect(String, Properties)method returnsnull.SQLException- See Also:
DataSource.getConnection()
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriterin interfaceCommonDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriterin interfaceCommonDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
getConnectionProperties
@NotNull public Properties getConnectionProperties()
-
-