Sitemap
Oracle Developers

Aggregation of articles from Oracle engineers, Oracle ACEs, and Java Champions on all things Oracle technology. The views expressed are those of the authors and not necessarily of Oracle.

Quickstart: Connect to Oracle AI Database 26ai using IntelliJ IDEA

4 min readMay 8, 2024

--

Press enter or click to view image in full size
Oracle AI Database 26ai

by Juarez Junior

Introduction

This blog post will guide you on connecting to Oracle AI Database 26ai 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, 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 AI Database 26ai — installation

There are numerous options available for developers, including an Oracle VM VirtualBox (OVA) image, several Linux versions, and the option to run 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 — provides a set of quick steps to run it as well.

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

Connect to Oracle AI Database 26ai using IntelliJ IDEA

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

Then, download the Oracle JDBC Driver 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 files as required.

Press enter or click to view image in full size
File -> New -> Data Source -> Drivers tab

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

Press enter or click to view image in full size
Oracle JDBC Driver 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.

Press enter or click to view image in full size
JDBC connection details

Make sure to select the driver you configured in the previous step. Click the Oracle link below, and select the Oracle JDBC 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.

Press enter or click to view image in full size
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.

Press enter or click to view image in full size
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.

Press enter or click to view image in full size
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.

Press enter or click to view image in full size

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

Press enter or click to view image in full size
Query console — custom query

Wrapping it up

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

I will soon post more examples of scenarios involving LangChain4J, the OracleEmbeddingStore, GraalVM, Micronaut, Quarkus, and other GenAI / Agentic AI-related topics!

We hope you liked this blog post. Stay tuned!

References

Oracle AI Database 26ai

Oracle AI Database 26ai Free Container Image

Oracle AI Database 26ai — JDBC Developer’s Guide

Oracle® AI Database JDBC Java API Reference, Release 26ai

Oracle® AI Database Universal Connection Pool Java API Reference, Release 26ai

IntelliJ IDEA

IntelliJ IDEA — Database Tools and SQL plugin with Oracle Databases

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!

--

--

Juarez Junior
Juarez Junior

Written by Juarez Junior

Senior Principal Developer Evangelist @ Oracle ☕️🐍🥑 https://linktr.ee/juarezjunior

Oracle Developers
Oracle Developers

Published in Oracle Developers

Aggregation of articles from Oracle engineers, Oracle ACEs, and Java Champions on all things Oracle technology. The views expressed are those of the authors and not necessarily of Oracle.