|
1 | 1 | # Tomcat Java Servlet
|
2 |
| -The Oracle JDBC drivers allow Java applications to connect and process data in the Oracle Database. Apache Tomcat is the application server for building and deploying Java EE applications. This repository contains a simple Java servlet along with the build scripts and instructions. The Java servlet that connects to the Oracle Database and performs some database operations. The |
| 2 | +The Oracle JDBC drivers allow Java applications to connect and process data in the Oracle Database. **Apache Tomcat** is the application server for building and deploying Java EE applications. This repository has code samples for a Java Servlet that connects to the Oracle Database using the Oracle JDBC driver. We have furnished `build.xml` to compile the servlet and the `Readme.md` that has instructions to compile and deploy this servlet on Tomcat. If you have subscribed to any Oracle Database Service on Cloud such as DBCS, EECS, BMCS etc., follow these instructions to verify the database connectivity with Tomcat. |
3 | 3 |
|
4 | 4 | # What you need to install?
|
5 | 5 |
|
6 |
| -* **Apache Tomcat**: Download and install the [Apache Tomcat v](http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html) |
| 6 | +* **Apache Tomcat**: Download and install [Apache Tomcat](https://tomcat.apache.org/) |
7 | 7 | * **Apache Ant**: Make sure you have [Apache ANT](http://ant.apache.org/) to compile the source code
|
8 | 8 | * **JDBC driver**: Download the latest JDBC driver [ojdbc8.jar from OTN](http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html)
|
| 9 | +* **Oracle Database**: You need to have a working Oracle Database with the credentials to verify the successful connection. Make sure either you have subscribed to Oracle Database Service on Cloud (DBCS, EECS, BMCS, ExaCS) or installed an Oracle Database on premise. |
9 | 10 |
|
10 | 11 | # Steps to compile the Java Servlet
|
11 | 12 |
|
12 | 13 | * **Update build.xml**: Download the `build.xml` present in this repository. Update TOMCAT_HOME to point to the location where Tomcat is installed.
|
13 |
| -* **Create a Resource in context.xml**: Create an Oracle Datasource through the admin console. Let us name this datasource as `orcljdbc_ds` |
14 |
| -* **Update JDBCSample_Servlet**: Download the `JDBCSample_Servlet` from this repository and make sure you are using the correct name of the Oracle datasource created through admin console. i.e., `orcljdbc_ds` in the method `getDataSource()` |
| 14 | +* **Create a Resource in context.xml**: Download the `context.xml` present in `META-INF` folder. Update the database URL, username, and password to point to your Oracle Database. Let us name this datasource as `orcljdbc_ds` |
| 15 | +* **Update JDBCSample_Servlet**: Download the `JDBCSample_Servlet` from this repository. Update the method `getDataSource()` to use the correct Oracle datasource name. E.g.,`orcljdbc_ds` |
| 16 | +* **JDBC driver**: Place the downloaded JDBC driver ojdbc8.jar in `WEB-INF/lib` folder. |
15 | 17 | * **Create the war file**: Go to the location where the `build.xml` is located. Execute the command `ant` that will compile and also create the `JDBCSample.war` file in the `dist` folder.
|
16 | 18 |
|
17 | 19 | # Steps to deploy and run the Java Servlet
|
18 | 20 |
|
19 | 21 | * **Deploy the WAR file**: Copy the `JDBCSample.war` file to TOMCAT_HOME/webapps/ and Start the Tomcat Server
|
20 | 22 | * **Invoke the Servlet**: Invoke the servlet at `https://localhost:8080/JDBCSample/JDBCSample_Servlet`
|
21 | 23 | * **Check the Results**: Check the results on the page and make sure that it prints driver information retrieved from the Oracle database.
|
| 24 | + |
| 25 | + |
| 26 | +# Other Resources |
| 27 | + |
| 28 | +* [Connecting Java Applications to Database Cloud Services](https://blogs.oracle.com/dev2dev/connecting-java-applications-to-database-cloud-services) |
| 29 | +* [Using Java Containers with Exadata Express Cloud Service (EECS)](http://www.oracle.com/technetwork/database/application-development/jdbc/jdbc-eecontainers-cloud.html#tomcat) |
0 commit comments