0
I am using Gemfire pivotal for the first time and I need someone who can help me with below question. The Gemfire Pivotal 9.6 is installed on Unix server and I am able to connect to Unix with no issue. I am inside unix now, but I can't access Gemfire. 

Q. How to Access OQL Query on a Gemfire 9.6 Region in java.

This is the way I connected to Unix.

private String host = "host name went here"; private String port = " port number here"; private String user = "userID"; private String password = "password" private String SSH command = "ssh ------" private String commandBah = "bash"; private String commandgfish = "sh /data/gemfire9.6/pivotal-gemfire-9.6.0/bin/gfsh";

        This is the way I am trying to connect to Gemfire which is not working properly now.



// Gemfire Connection URL, username and password 
            private String connect To Gemfire = "connect --locator=--------";
            private String username = "credential";--
            private String command Pass = "password"
            private String comman Setvariable  = "set variable --name=APP_RESULT_VIEWER --value=EXTERNAL";
S Akin Sabak
  • 57
  • 1
  • 2
  • 10

1 Answers1

0

To access a region in java, you need to create a GemFire client. Here's a basic java snippet that creates a GemFire client and execute a query:

ClientCache cache = new ClientCacheFactory()
      .addPoolLocator(locator_host, 10334)
      .create()
cache.getQueryService().newQuery("select count(*) from /region").execute()

For a more complete example, you can take a look at the geode examples project (GemFire is based on Geode). Here's an example of querying from the client: https://github.com/apache/geode-examples/tree/master/indexes

Dan Smith
  • 481
  • 2
  • 3