GridGain Developers Hub

Connect SQL Application

On the previous step of the tutorial we have provisioned a cluster. After provisioning is complete and cluster is available, you can connect an application to it. Nebula will offer you common connection parameters.

In this tutorial, we will connect to Nebula by using the JDBC client provided with GridGain or Apache Ignite.

Required Applications

In this tutorial we will use an example database and a preconfigured sqlline client that are shipped with GridGain. To use them, you will need one of the following:

  • Docker application or

  • GridGain Software or

  • Apache Ignite.

Connect to Nebula

You will need to use an SQL Client to connect to the database. In this example we are using the SQL client and example database that are provided with GridGain or Apache Ignite, but you can use the same concept with any client.

  • If you already have connection information, proceed to the next step. Otherwise:

    • Click ⋮ next to the cluster you are using.

    • Click Cluster info.

    • Copy the Address field.

  • Run the sqlline script to establish connection to the Nebula cluster.

    docker run --rm -it gridgain/community:8.8.18 bin/ --verbose=true -u "jdbc:ignite:thin://{url}:10800;user={username};password={password};sslMode=require"
    :: If you do not have a local GridGain installation, get it from
    cd {your-gridgain-folder}
    bin/sqlline.bat --verbose=true -u "jdbc:ignite:thin://{url}:10800;user={username};password={password};sslMode=require"
    # If you do not have a local GridGain installation, get it from
    cd {your-gridgain-folder}
    bin/ --verbose=true -u "jdbc:ignite:thin://{url}:10800;user={username};password={password};sslMode=require"
  • Check the connection status with the !list command.

    connect app 2

  • Run the world.sql command with !run command.

!run examples/sql/world.sql

Check the Results

We will use GridGain Nebula to make sure that the query was executed correctly.

  • Go to GridGain Nebula.

  • Open the SQL screen.

  • Execute the following command:

    SELECT * FROM Country;

GridGain Nebula will query the table Country and display the results:

connect app 3

Destroy or Suspend the Cluster

When you are done with cluster, remember to destroy or suspend it to avoid spending extra credit or money. Go to the Clusters screen. In it, click ⋮ and select Suspend or Destroy. Suspended clusters are not billed and can be quickly brought back online. Destroyed clusters have all their information removed and must be restarted from scratch.

Connect your Application to Cluster

After you are done with the demo application, connect one of your own as described in the Connecting your Application section. GridGain Nebula works with a wide variety of languages.

You can learn more about using GridGain APIs in the GridGain documentation.