- 오라클기준 -
- Connection Pool 사용시 기본 라이브러리
commons-dbcp.jar
commons-collections.jar
commons-pool.jar
- 오라클 JDBC 라이브러리
classes12.jar
- 해당 context의 server.xml을 설정.
<Resource name="jdbc/jsptest"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
loginTimeout="10"
maxWait="5000"
username="db_ID"
password="db_PASS"
testOnBorrow="true"
url="jdbc:oracle:thin:@127.0.0.1:1521:db_SID"
/>
- 해당 context의 web.xml을 설정.
<resource-ref>
<description>jsptest db</description>
<res-ref-name>jdbc/jsptest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
- JSP에서 호출 방법.
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/jsptest");
Connection conn = ds.getConnection();
'Infomation > Tip & Tech' 카테고리의 다른 글
엑셀 단축키 모음 (0) | 2008.01.11 |
---|---|
SW기술자 노임단가 및 기술등급 (2008년도) (1) | 2008.01.02 |
합계액(공급가액+부가세)에서 부가세 계산하기 (2) | 2007.11.30 |
SW기술자 노임단가 및 기술등급 (2007년도) (0) | 2007.11.26 |
DLL lib 동적 정적 라이브러리 작성 (0) | 2007.11.26 |