import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.THttpClient;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import java.nio.ByteBuffer;
import datahub.*;

/** 
 * Sample Java Client for DataHub
 * 
 * @author anantb
 * @date 11/07/2013
 * 
 */

public class SampleClient {
  public static void main(String [] args) {
    try {
      TTransport transport = new THttpClient("http://datahub.csail.mit.edu/service");
      TProtocol protocol = new  TBinaryProtocol(transport);
      DataHub.Client client = new DataHub.Client(protocol);

      System.out.println("Version: " + client.get_version());

      // open connection
      ConnectionParams con_params = new ConnectionParams();
      con_params.setUser("anantb");
      con_params.setPassword("anant");
      Connection con = client.open_connection(con_params);
	     
      // execute a query
      ResultSet res = client.execute_sql(con, "select * from anantb.test.demo", null);

      // print field names
      for (String field_name : res.getField_names()) {
        System.out.print(field_name + "\t");
      }

      System.out.println();

      // print tuples
      for (Tuple t : res.getTuples()) {
        for (ByteBuffer cell : t.getCells()) {
          System.out.print(new String(cell.array()) + "\t");
        }
        System.out.println();
      }	  
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}

@@ -403,16 +403,318 @@
   try %7B%0A
+      // Before running you will need to populate the below variables%0A      // and create a corresponding repo and table in your datahub acount%0A      %0A      String username = %22anantb%22;%0A      String password = %22anant%22;%0A      String repo = %22test%22;%0A      String table = %22demo%22;%0A      %0A      // http setup%0A
       TT
@@ -1085,24 +1085,24 @@
 setUser(
-%22anantb%22
+username
 );%0A     
@@ -1125,23 +1125,24 @@
 assword(
-%22anant%22
+password
 );%0A     
@@ -1212,105 +1212,541 @@
     
-// execute a query%0A      ResultSet res = client.execute_sql(con, %22select * from anantb.test.demo%22
+%0A      /********************************************************%0A      CONNECT TO AND QUERY DB USING YOUR USERNAME AND PASSWORD%0A      ********************************************************/%0A      // This will initially thrown an exception.%0A      // You will need to create a username, password,%0A      // repository, and table to query.%0A      System.out.println(%22%5Cn%5CnTrying to query a user's table...%22);%0A      String query = %22select * from %22 + username + %22.%22 + repo + %22.%22 + table;%0A      ResultSet res = client.execute_sql(con, query
 , nu

update java SampleClient