如何在java中的Gemfire 9.6区域上访问OQL查询

问题描述 投票:0回答:1
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.

这是我连接Unix的方式。

private String host =“host name goes 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";
unix gemfire oql
1个回答
0
投票

要在java中访问区域,您需要创建GemFire客户端。这是一个基本的java片段,它创建一个GemFire客户端并执行一个查询:

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

有关更完整的示例,您可以查看geode示例项目(GemFire基于Geode)。以下是从客户端查询的示例:https://github.com/apache/geode-examples/tree/master/indexes

© www.soinside.com 2019 - 2024. All rights reserved.