Use Oracle FreeSQL.com as a remote test database

FreeSQL.com lets you use a free, hosted Oracle AI Database instance right from your browser. But, FreeSQL can also be used as a remote database for testing, POCs, and more!

In this article, we’ll walk though how to connect to a FreeSQL database from your local machine, no database setup required.

Login to FreeSQL.com

To use FreeSQL as a remote database, you’ll need to login using your Oracle account. If you don’t have an Oracle account, create a free account here.

From the FreeSQL homepage, click “Sign In” in the top right corner:

A screenshot of the FreeSQL interface showing the SQL Worksheet, navigation panel on the left with Human Resources tables, and a prominent 'Sign In' button highlighted at the top right.

Generate database connection string

Once you’re logged in, click the “Connect” button on the top right nav bar:

Screenshot of the FreeSQL interface showing the SQL Worksheet, a navigation panel, and a prompt instructing to click the 'Connect' button to generate a connection string.

This opens a model dialogue to generate your connection string:

  1. Click “Regenerate” to create a new FreeSQL password.
  2. Copy the SQLcl or code sample of your preferred language, which will be populated with the newly generated password
  3. Connect!
Screenshot displaying database connection details including hostname, port, username, password input, and instructions for SQLCl and web application creation using NodeJS.

Connect!

For SQLcl, connecting to FreeSQL looks like this:

sql '<SCHEMA>/<PASSWORD>@//db.freesql.com:1521/26ai_un3c1'

If you’re using Java, you can create a Java DataSource like this:

import java.sql.*;

public class OracleConnection {
    public static void main(String[] args) {
        String host = "jdbc:oracle:thin:@db.freesql.com:1521/26ai_un3c1";
        String username = "<SCHEMA>";
        String password = "<PASSWORD>";
        try {
            Connection conn = DriverManager.getConnection(host, username, password);
            System.out.println("Connected to Oracle database");
        } catch (SQLException e) {
            System.out.println("Failed to connect to Oracle database");
            e.printStackTrace();
        }
    }
}

Once you’re connected, you can test out features of Oracle AI Database using the tools or programming of your choice!

Response

  1. […] Use Oracle FreeSQL.com as a remote test database – Anders Swanson shows how anybody with an Internet connection can connect to their own, […]

Leave a Reply

Discover more from andersswanson.dev

Subscribe now to keep reading and get access to the full archive.

Continue reading