tomcat 폴더 /conf/server.xml 혹은 deploy 시킬 xml(webapps\test.xml) 수정
<Context> 태그 안에 추가
-- oracle
<Resource name="jdbc/DbCon" auth="Container" type="oracle.jdbc.pool.OracleDataSource" driverClassName="oracle.jdbc.driver.OracleDriver" factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@localhost:1521:xe" user="***" password="***" maxActive="100" maxIdle="10000" maxWait="-1" />
-- mssql
<Resource name="jdbc/DbCon" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="aa" password="aa" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://IP:PORT/DBNAME"/>
web.xml 추가
<resource-ref>
<res-ref-name>jdbc/DbCon</res-ref-name>
<res-type>oracle.jdbc.pool.OracleDataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
jdbc/DbCon 을 사용해서 프로그램
import javax.naming.*
import javax.sql.*
import oracle.jdbc.pool.OracleDataSource
Context initContext = new InitialContext();
DataSource ds = (DataSource)initContext.lookup("java:/comp/env/jdbc/DbCon");
Connection con = ds.getConnection();
'Servers' 카테고리의 다른 글
oracle instant client 설치하기 (2) | 2010.10.01 |
---|---|
Window CGI 실행 및 apache 연동 (1) | 2010.06.22 |
apache weblogic 연동 (1) | 2010.04.21 |
weblogic 개발모드 세팅 (1) | 2010.04.21 |
weblogic 한글 인코딩 세팅 (1) | 2010.04.21 |