The client uses the GPSS Connect service to connect to a specific 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 Greenplum Database 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 Greenplum Database. The client must also provide the session when it disconnects from Greenplum Database.

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;

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 gpMasterHost = "localhost";
Integer gpMasterPort = 15432;
String gpRoleName = "gpadmin";
String gpPasswd = "changeme";
String dbname = "testdb";

// create a connect request builder
ConnectRequest connReq = ConnectRequest.newBuilder()

// 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

After the GPSS client connects to Greenplum Database, 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