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(); |
![]() |
'Programming' 카테고리의 다른 글
The Three Scopes : Context, Request, and Session (0) | 2009.08.11 |
---|---|
속성(파라미터) (0) | 2009.08.11 |
7. 오라클 - 그룹함수(SUM, AVG, MAX, MIN, COUNT) (0) | 2009.07.24 |
6. 오라클 - 단일행함수들 3)변환 함수(TO_CHAR, NVL) (0) | 2009.07.16 |