|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectkr.co.hit.live.transaction.datasource.SimpleDataSource
public class SimpleDataSource
Pooling 기능이 없는 javax.sql.DataSource의 구현이다.
Transaction 여부에 따라서 새로운 Connection 객체 또는 기존에 생성된 Connection 객체를 리턴한다.
생성자에 넘겨주는 Properties 객체에 정의되는 프로퍼티들은 다음과 같다.
| Field Summary | |
|---|---|
protected String |
datasourceName
|
protected boolean |
jdbcAutoCommit
|
protected String |
jdbcDriver
|
protected String |
jdbcPassword
|
protected String |
jdbcUrl
|
protected String |
jdbcUsername
|
| Constructor Summary | |
|---|---|
SimpleDataSource(Properties props)
생성자이다. |
|
| Method Summary | ||
|---|---|---|
Connection |
getConnection()
Connection 객체를 리턴한다. |
|
Connection |
getConnection(String username,
String password)
주어진 사용자 아이디와 암호를 사용하여 데이터베이스에 Connection 객체를 리턴한다. |
|
String |
getDatasourceName()
Datasouce 명을 리턴한다. |
|
int |
getLoginTimeout()
DriverManager 클래스의 getLoginTimeout()를 호출한다. |
|
PrintWriter |
getLogWriter()
DriverManager 클래스의 getLogWriter()를 호출한다. |
|
boolean |
isWrapperFor(Class<?> iface)
|
|
void |
setLoginTimeout(int seconds)
DriverManager 클래스의 setLoginTimeout()를 호출한다. |
|
void |
setLogWriter(PrintWriter out)
DriverManager 클래스의 setLogWriter()를 호출한다. |
|
|
unwrap(Class<T> iface)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String jdbcUsername
protected String jdbcPassword
protected String jdbcUrl
protected String jdbcDriver
protected boolean jdbcAutoCommit
protected String datasourceName
| Constructor Detail |
|---|
public SimpleDataSource(Properties props)
생성자이다. 설정에 필요한 속성값들은 Properties 객체내에 정의한다.
props - 생성시 사용할 속성값들이 정의된 Properties 객체| Method Detail |
|---|
public String getDatasourceName()
Datasouce 명을 리턴한다.
public Connection getConnection()
throws SQLException
Connection 객체를 리턴한다. 현재 Transaction 진행여부와 autocommit 설정 여부에 따라서 다음과 같이 Connection 객체를 반환한다.
getConnection in interface DataSourceSQLException - 데이터베이스 연결 시 에러가 발생할 때 또는
트랜젝션에 이미 다른 datasource 명으로 Connection 객체가 생성되어 트랜젝션에 연결되어 있는 경우
public Connection getConnection(String username,
String password)
throws SQLException
주어진 사용자 아이디와 암호를 사용하여 데이터베이스에 Connection 객체를 리턴한다.
getConnection in interface DataSourceusername - database 연결시 사용할 사용자 IDpassword - 사용자 암호
SQLException - 데이터베이스 연결 시 에러가 발생할 때, Datasource 설정과 다른 User/Password를 지정했을 때
public PrintWriter getLogWriter()
throws SQLException
DriverManager 클래스의 getLogWriter()를 호출한다.
getLogWriter in interface CommonDataSourceSQLException - 데이터베이스 에러가 발생할 때
public void setLogWriter(PrintWriter out)
throws SQLException
DriverManager 클래스의 setLogWriter()를 호출한다.
setLogWriter in interface CommonDataSourceout - 설정할 log writer 객체
SQLException - 데이터베이스 연결 시 에러가 발생할 때
public int getLoginTimeout()
throws SQLException
DriverManager 클래스의 getLoginTimeout()를 호출한다.
getLoginTimeout in interface CommonDataSourceSQLException - 데이터베이스 에러가 발생할 때
public void setLoginTimeout(int seconds)
throws SQLException
DriverManager 클래스의 setLoginTimeout()를 호출한다.
setLoginTimeout in interface CommonDataSourceseconds - 데이터베이스 로그인 최대 시간(초)
SQLException - 데이터베이스 에러가 발생할 때
public boolean isWrapperFor(Class<?> iface)
throws SQLException
isWrapperFor in interface WrapperSQLException
public <T> T unwrap(Class<T> iface)
throws SQLException
unwrap in interface WrapperSQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||