2 Using Maven and Gradle
The following sections provide information about how to connect to Oracle Autonomous Database using a Maven project or a Gradle project.
Topics:
- Using a Maven Project
You can establish a connection to Oracle Autonomous Database using a Maven project. - Using a Gradle Project
You can establish a connection to Oracle Autonomous Database using a Gradle project.
2.1 Using a Maven Project
You can establish a connection to Oracle Autonomous Database using a Maven project.
- Setting Up a Maven Project
This section lists the steps to set up a Maven project. - Building and Running a Sample Java Program
This section lists the steps to build and run a sample Java program.
Parent topic: Using Maven and Gradle
2.1.1 Setting Up a Maven Project
This section lists the steps to set up a Maven project.
Parent topic: Using a Maven Project
2.1.2 Building and Running a Sample Java Program
This section lists the steps to build and run a sample Java program.
pom.xml
file is present.
Sample Output:
The screenshot below shows the queried rows, along with a success message:

Note:
If you connect to the Oracle Database from behind a firewall, you will likely encounter a connection timeout error. Make sure to be outside the firewall while running this sample or update the tnsnames.ora
file to use an HTTPS proxy.
See Also:
Using Oracle Autonomous Database Serverless for more information.Parent topic: Using a Maven Project
2.2 Using a Gradle Project
You can establish a connection to Oracle Autonomous Database using a Gradle project.
- Setting Up a Gradle Project
This section lists the steps to set up a Gradle project. - Building and Running the Gradle Application
This section lists the steps to build and run the Gradle application.
Parent topic: Using Maven and Gradle
2.2.1 Setting Up a Gradle Project
This section lists the steps to set up a Gradle project.
Parent topic: Using a Gradle Project
2.2.2 Building and Running the Gradle Application
This section lists the steps to build and run the Gradle application.
build.gradle
file is present.
The screenshot below shows the queried rows, along with a success message:

Note:
If you connect to Oracle Autonomous Database from behind a firewall, you will likely encounter a connection timeout error. Make sure to be outside the firewall while running this sample or update the tnsnames.ora
file to use an HTTPS proxy.
See Also:
Using Oracle Autonomous Database Serverless for more information.Parent topic: Using a Gradle Project