I have been trying to connect to my EMR cluster from java code to run a presto query. Until now I created a "maven project", and added "presto dependancy" in the "pom.xml". I have been referring this link for the program
https://gist.github.com/nagataka/2c2d9fa49b03e8556faf85345b43f59c
I have two questions:
1.) How do I connect to the EMR cluster with username and password like in the " conn = DriverManager.getConnection(DB_URL, USER, PASS);" used in the above reference. Because I use a ".ppk key" to validate the connection. I dunno how to give the key in this context.
2.) How do I run a simple "show tables;" query on Presto.
The following is my program:
package presto.presto_sample;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.*;
/**
* Hello world!
*
*/
public class App
{
static final String JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver";
static final String DB_URL = "jdbc:presto://ec2-18-191-128-219.us-east-2.compute.amazonaws.com:8889/hive/default";
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}