Teradata and Java server Connection

Spread the love

Question Description

I am trying to connect to JAVA server using Teradata UDF, here is my code below.It uses HOST as “localhost” and PORT(integer) as “9091” and all the parameters such as PEM file location etc have been provided, but the function always exits from the catch block.I know that exit(0) is not allowed in Teradata UDF’s, I have used it just for the sake of debugging.The same code connects to the server absolutely fine in case ORACLE UDF. Please tell which ports can be used for communication in case of Teradata, or whether an SSL connection to server is even supported in Teradata.
The server accepts argument of type request and returns result ,both of type vector .

  Response CplusplusClient::startClient(DeTokenizationRequest request) {
  boost::shared_ptr factory(new TSSLSocketFactory());
  factory->loadPrivateKey(PRIVATE_KEY.c_str());
  factory->loadCertificate(CERTIFICATE.c_str());
  factory->loadTrustedCertificates(TRUSTED_CERTIFICATE.c_str());
  factory->authenticate(true);
  boost::shared_ptr socket = factory->createSocket(HOST,PORT);

  boost::shared_ptr transport(new TBufferedTransport(socket));
  boost::shared_ptr protocol(new TBinaryProtocol(transport));
  XSecurityServiceClient client(protocol);

  Response result;

 try {
    transport->open();
    client.requested(result, request);
    transport->close();
  } catch (TException& tx) {
    exit(0);
  }
  return result;
}
}

Practice As Follows

Changed the Port to 9092 and it worked

Tags

Not what you're looking for? Browse other questions tagged

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.