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 String
CONNECTION_ATTEMPTS_PROPERTY
The name of the internal property holding the number of connection attempts.protected PrintWriter
myLogWriter
-
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 Connection
getConnection()
Connection
getConnection(String username, String password)
Properties
getConnectionProperties()
Driver
getDriver()
int
getLoginTimeout()
PrintWriter
getLogWriter()
Logger
getParentLogger()
Version
getVersion()
boolean
isWrapperFor(Class<?> iface)
void
setLoginTimeout(int seconds)
void
setLogWriter(PrintWriter out)
<T> T
unwrap(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:
getConnection
in 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:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
getConnectionProperties
@NotNull public Properties getConnectionProperties()
-
-