Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- GIT
- JavaScript
- 네트워크
- grep
- 단축키
- Mac
- Quartz
- IntelliJ
- resource
- Eclipse
- Source
- Windows
- netsh
- ssh
- web.xml
- xargs
- maVen
- plugin
- vscode
- lsof
- bash
- find
- import
- VirtualBox
- profile
- Windows 10
- tomcat
- context
- port
- 줄바꿈 문자
Archives
- Today
- Total
develog
eclipse tomcat dbcp 셋팅 (connection pool) 본문
Tomcat ROOT/lib/tomcat-dbcp.jar
- /WebContent/META-INF/context.xml 수정
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource
name="jdbc/testdb"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="DB_USERNAME"
password="DB_PASSWORD"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@127.0.0.1:1521:DB_NAME"
maxActive="10"
maxIdle="4"
/>
</Context>
- server project - context.xml 수정
<Context>
<Resource
name="jdbc/testdb"
auth="Container"
type="javax.sql.DataSource"
username="DB_USERNAME"
password="DB_PASSWORD"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@127.0.0.1:1521:DB_NAME"
maxActive="10"
maxIdle="4"
/>
</Context>
- JNDI 리소스 가져오기
Context initCtx = new InitialContext();
Context envCtx = (Context)initCtx.lookup("java:/comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/testdb");
Connection conn = ds.getConnection();
System.out.println("conn : " + conn);
'Web & WAS > Tomcat' 카테고리의 다른 글
tomcat, context.xml, resource 설정 (0) | 2013.07.17 |
---|---|
maxParameterCount (0) | 2013.07.16 |
DBCP 커넥션 풀 옵션 (connection pool) (0) | 2013.06.24 |
apache tomcat java 버전 (0) | 2013.02.13 |
아파치 1대 + 톰캣 여러대 설정 (0) | 2012.07.09 |
Comments