Connect Java Application
One the previous step of the tutorial, we provisioned a cluster. After provisioning is complete, and the cluster is available, you can connect your application. Nebula will offer you common connection parameters.
In this tutorial, we will connect to Nebula by using a simple Java thin client in the provided Java application.
Get connection information
The last step of the provisioning wizard provides the connection examples. Switch to the Java Thin Client connection sample.
On the next step you will need to update the
ClientConfiguration cfg object in the provided demo with the object from the configuration template.
Connect to Nebula
In this tutorial we will use a simple demo application that connects to the cluster and writes 10 random text values in the cache. To connect the demo application to the cluster:
ClientConfiguration cfg = new ClientConfiguration() .setAddresses("Your-Nebula-Address") .setUserName("USERNAME") .setUserPassword("PASSWORD") .setSslMode(SslMode.REQUIRED);
PASSWORDplaceholders with user credentials you have specified previously.
Run the application.
After the application runs, you will be able to see the newly created cache. It also retrieves new data from the cache and displays it in the log.
Destroy the Cluster
When you are done with cluster, remember to destroy it to avoid spending extra credits or money. Go to the Clusters screen