Simon Griffiths

Focusing on Data, Architecture and AI

Simon Griffiths architects data-first systems, and is sceptical about the rest.

Drawing on long experience across enterprise data, architecture, and AI, he prefers platforms designed for reality, not just the latest narrative.

, ,

Building Apps on Oracle with AI on a Mac

The most talked about way of connecting to an Oracle database from AI, whether Codex, Claude Code or another AI is MCP – it’s great and enables you to easily connect and query the database with natural language. But what if you are building an app, it’s not about ad-hoc queries, the focus is on repeatability, capturing exact commands, repetitive testing and build scripts. MCP is actually not the best approach – sometimes existing techniques work just as well, and in this case better.

When I want to run sql scripts against an oracle database, I tell my AI to use SQLcl this has a great set of necessary features to run SQL from an AI coding tool, and a lot more besides. The most useful aspect is the ability to define named connections. This allows everything about a database connection to be saved to a specific name, which can then be used directly from the AI as a command line, here’s an example:

sql -name my_connection

It really is that easy! This includes the wallet details (the wallet path is saved) the username and password (which means that you can avoid putting passwords in any scripts orc the environment) and the service name (which is really helpful for connecting to ADB). Save as many different name’s as you need, and of course even you are using SQLcl interactively, all these connections are still available.

So, to save your connection, you’ll need to do start sqlcl and do something like this :

sql /nolog
set cloudconfig path_to_your_wallet
connect -save connection_name -rp -savepwd username/password@servicename

Then exit and try logging in using the name as above.

Finally a few tips on installing SQLcl on a Mac

You’ll need to install Java :

brew install java
brew install sqlcl

Set your path to include the java bin directory and the sqlcl bin, and also set JAVAHOME :

export PATH=”/opt/homebrew/opt/openjdk/bin:$PATH”
export JAVA_HOME=/opt/homebrew/opt/openjdk
export SQLPATH=/Users/your_user/sql

I put this into my .zshrc so that they are always available from any shell.

Happy building !

Leave a comment

Navigation

About

Simon Griffiths architects data-first systems, sceptical about the rest. Drawing on long experience across enterprise data, architecture, and AI, he prefers platforms designed for reality, not just the latest narrative.