The client uses the GPSS Connect service to connect to a specific VMware Greenplum database. The Disconnect service closes the connection to Greenplum.

The Connect and Disconnect service definitions follow:

rpc Connect(ConnectRequest) returns (Session) {}
rpc Disconnect(Session) returns (google.protobuf.Empty) {}

The client specifies the information required to connect to VMware Greenplum in a ConnectRequest message. The Connect service returns a Session message. The session identifies the client's connection to the GPSS server. The client must provide the session when it invokes metadata- and table-related services on VMware Greenplum. The client must also provide the session when it disconnects from VMware Greenplum.

The ConnectRequest and Session message definitions:

message ConnectRequest {
  string Host = 1;
  int32 Port = 2;
  string Username = 3;
  string Password = 4;
  string DB = 5;
  bool UseSSL = 6;
  int32 SessionTimeout=7;
}

message Session {
  string ID = 1;
}

The following sample includes Java client code to:

  • Create and populate a ConnectRequest protocol buffer object.
  • Use the blocking stub to call the Connect service.
  • Save the Session response object.
  • Disconnect the session.
Session mSession = null;
String gpCoordHost = "localhost";
Integer gpCoordPort = 15432;
String gpRoleName = "gpadmin";
String gpPasswd = "changeme";
String dbname = "testdb";

// create a connect request builder
ConnectRequest connReq = ConnectRequest.newBuilder()
    .setHost(gpCoordHost)
    .setPort(gpCoordPort)
    .setUsername(gpRoleName)
    .setPassword(gpPasswd)
    .setDB(dbname)
    .setUseSSL(false)
    .setSessionTimeout(1000)
  .build();

// use the blocking stub to call the Connect service
mSession = bStub.connect(connReq);

// (placeholder) do greenplum stuff here

// use the blocking stub to call the Disconnect service
bStub.disconnect(mSession);

After the GPSS client connects to VMware Greenplum, the client can invoke service requests to retrieve information about schemas and tables, and write to Greenplum tables.

check-circle-line exclamation-circle-line close-line
Scroll to top icon