0. Introduction
Oracle requires minimal changes from the MySQL configuration except for the usual gotchas :-)
Drivers for older Oracle versions may be distributed as *.zip files rather
than *.jar files. Tomcat will only use *.jar files installed in
$CATALINA_HOME/common/lib. Therefore classes111.zip
or classes12.zip will need to be renamed with a .jar
extension. Since jarfiles are zipfiles, there is no need to unzip and jar these
files - a simple rename will suffice.
For Oracle 9i onwards you should use oracle.jdbc.OracleDriver
rather than oracle.jdbc.driver.OracleDriver as Oracle have stated
that oracle.jdbc.driver.OracleDriver is deprecated and support
for this driver class will be discontinued in the next major release.
1. Context configuration
In a similar manner to the mysql config above, you will need to define your Datasource in your Context. Here we define a Datasource called myoracle using the thin driver to connect as user scott, password tiger to the sid called mysid. (Note: with the thin driver this sid is not the same as the tnsname). The schema used will be the default schema for the user scott.
Use of the OCI driver should simply involve a changing thin to oci in the URL string.
<Resource name="jdbc/myoracle" auth="Container" |
||
2. web.xml configuration
You should ensure that you respect the element ordering defined by the DTD when you create you applications web.xml file.
<resource-ref> |
||
3. Code example
You can use the same example application as above (asuming you create the required DB instance, tables etc.) replacing the Datasource code with something like
Context initContext = new InitialContext(); |
'DB > Oracle' 카테고리의 다른 글
| Oracle 8i, 9i & 10g 데이터베이스 연결 설정법 (0) | 2009/08/10 |
|---|---|
| 7. 오라클 - 그룹함수(SUM, AVG, MAX, MIN, COUNT) (0) | 2009/07/24 |
| 6. 오라클 - 단일행함수들 3)변환 함수(TO_CHAR, NVL) (0) | 2009/07/16 |
| 5. 오라클 - 단일행함수들 3)날짜함수(SYSDATE, ADD_MONTHS, LAST_DAY, MONTHS_BETWEEN) (1) | 2009/07/16 |
| 4. 오라클 - 단일행함수들 2)문자함수(LOWER, SUBSTR) (0) | 2009/07/16 |