Quickstart: Connect to Oracle Database 23ai using IntelliJ IDEA

Juarez Junior
4 min readMay 8, 2024

--

Oracle Database 23ai

by Juarez Junior

Introduction

Oracle Database 23a is the next long-term support release of the industry-leading Oracle Database. It provides over 300 new features, strongly focusing on Artificial Intelligence (AI) and developer productivity.

This blog post will guide you on connecting to Oracle Database 23ai using IntelliJ IDEA — one of the many options Java developers have when choosing a good IDE to develop their applications.

However, it is not an exhaustive exploration of all the options available when using IntelliJ IDEA to connect to Oracle Databases. Its goal is to provide a quick guide to configure your Oracle JDBC connections.

Speaking of JDBC and the Oracle JDBC Driver 23ai, please check the JDBC Developer’s Guide for all the options and configurations available concerning the driver and JDBC database URLs.

So, without further ado, let’s get started!

Prerequisites

Oracle Database 23ai — installation

There are plenty of options available for developers, including an Oracle VM VirtualBox (ova) image, several Linux versions, and also available in the cloud on Exadata Database Service, Base Database Service, and Always Free Autonomous Database.

There’s also a container image available on Oracle Container Registry (OCIR) that you can use to install it, so that’s the option used in this blog post. A previous blog post — Oracle AI Vector Search for Java Developers with the Oracle Database 23ai — provides a set of quick steps to run it.

However, you can also check the official documentation for a more comprehensive guide.

Connect to Oracle Database 23ai using IntelliJ IDEA

First, you must enable the Database Tools and SQL plugin provided by IntelliJ IDEA.

Then, download the Oracle JDBC Driver 23ai (23.4.0.24.05) files.

Next, you must create a data source and configure the connection details. Select File -> New -> Data Source and select Oracle.

Then, select the Drivers tab and click the plus (+) sign to add the Oracle JDBC Driver 23ai (23.4.0.24.05) files as required.

File -> New -> Data Source -> Drivers tab

Please navigate to the directory where you downloaded the files and select them.

Oracle JDBC Driver 23ai (23.4.0.24.05) files

Now select the Data Sources tab, where you will provide the database connection details. Oracle supports many different connection types and JDBC URL options. You’ll use a simple JDBC URL; an example follows.

jdbc:oracle:thin:@localhost:1521/FREEPDB1

Next, provide all the usual JDBC connection details, as shown below.

JDBC connection details

Make sure to select the driver you configured in the previous step. Click the Oracle link below, and select the Oracle 23ai driver you configured.

To finish configuring the connection details, click the Test Connection link. A message with the status Succeeded will be presented in the following screenshot.

Test Connection — Succeeded

Run SQL statements

To run SQL statements, you have to open the query console. Select your data source, then hit the F4 key. The query console will open.

Query Console

Here’s an example to run a simple SQL query to confirm the Oracle Database version.

SELECT * FROM V$VERSION;

Paste your SQL query, and click the Run button. An Output tab with the query results (Result 1) will open.

Query console — test query

Run SQL Scripts

You can also run SQL scripts. Select SQL Scripts -> Run SQL Script…, then navigate to the directory where you can find your SQL script, and click OK.

After running a script, remember that you can always run your queries on the query console if you will. Another example is below.

Query console — custom query

Wrapping it up

That’s it! Now you’re all set to create your Java applications with the Oracle Database 23ai, the Oracle JDBC Driver 23ai and IntelliJ IDEA.

I hope you found this quick guide helpful!

References

Oracle Database 23ai

IntelliJ IDEA

IntelliJ IDEA — Database Tools and SQL plugin with Oracle Databases

Oracle Database Free Release 23ai — Container Image

Oracle® Database JDBC Java API Reference, Release 23ai

Oracle JDBC Driver 23ai (23.4.0.24.05) — Maven Central

Developers Guide For Oracle JDBC on Maven Central

Develop Java applications with Oracle Database

Oracle Developers and Oracle OCI Free Tier

Join our Oracle Developers channel on Slack to discuss Java, JDK, JDBC, GraalVM, Microservices with Spring Boot, Helidon, Quarkus, Micronaut, Reactive Streams, Cloud, DevOps, IaC, and other topics!

Build, test, and deploy your applications on Oracle Cloud — for free! Get access to OCI Cloud Free Tier!

--

--