Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: revise code snippet for HIVE-6486: line breaks; indentation; "});" -> "}};"

...

The following code snippet illustrates the usage (refer to HIVE-6486 for a complete test case):

Code Block
languagejava
         static Connection getConnection( Subject signedOnUserSubject ) throws Exception{
                Connection conn = (Connection) Subject.doAs(signedOnUserSubject, new PrivilegedExceptionAction<Object>()
                       {
         {
      public Object run()
               {
 public  Object run()
                   Connection con = null;
  {
                     String JDBC_DB_URL = "jdbc:hive2://HiveHost:10000/default;" ||
       Connection con = null;
                                String JDBC_DB_URL  = "jdbc:hive2://HiveHost:10000/default;principal=hive/localhost.localdomain@EXAMPLE.COM;auth=kerberos;kerberosAuthType=fromSubject";
" || 
                                         try {     "auth=kerberos;kerberosAuthType=fromSubject";
                       try {
                               Class.forName(JDBC_DRIVER);
                                        con =  DriverManager.getConnection(JDBC_DB_URL);
       ;
                         } catch (SQLException e) {
                                        e.printStackTrace();
                                } catch (ClassNotFoundException e) {
                                        e.printStackTrace();
                                }
                                return con;
                        }
                                });
         }};
       return conn;

Python Client

...