Configuring Virtual Private Cloud (VPC) Services

You can configure the connector to connect to Presto using a Virtual Private Cloud (VPC) service. To do this, use the following connection properties:

  • SocketFactory
  • SocketFactoryArg
  • DnsResolver
  • DnsResolverArg

The SocketFactory property extends javax.net.SocketFactory, and the DnsResolver property implements com.interfaces.networking.CustomDnsResolver. The SocketFactoryArg and DnsResolverArg properties pass any required arguments to these services.

The properties in the following instructions are all optional, and only need to be used if you are connecting through the relevant service.

To configure the connector to use a VPC:

  1. If necessary, set the SocketFactory property to the fully-qualified class path for a class that extends javax.net.SocketFactory and provides the socket factory implementation.
  2. If necessary, set the SocketFactoryArg to a string argument to pass to the constructor of the class indicated by the SocketFactory property.
  3. If necessary, set the DnsResolver property to the fully-qualified class path for a class that extends the DnsResolver interface for the connector, com.interfaces.networking.CustomDnsResolver.
  4. If necessary, set the DnsResolverArg to a string argument to pass to the constructor of the class indicated by the DnsResolver property.

For example, the following connection URLs show how to connect to data sources using the supported VPCs.

Using SocketFactory:

jdbc:presto://192.168.203.141:8080;User=simba;SocketFactory=com.simba.junit.jdbc.utils.CustomSocketFactory;SocketFactoryArg=Args;

Using DnsResolver:

jdbc:presto://192.168.203.141:8080;User=simba;DnsResolver=com.simba.junit.jdbc.utils.TestDnsResolver;DnsResolverArg=agrs;

Using both SocketFactory and DnsResolver:

jdbc:presto://192.168.203.141:8080;User=simba;DnsResolver=com.simba.junit.jdbc.utils.TestDnsResolver;DnsResolverArg=Agrs;SocketFactory=com.simba.junit.jdbc.utils.CustomSocketFactory;SocketFactoryArg=Args;