I have changed permission using hdfs command. Still it showing same error.
The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: -wx------
Java Program that I am executing.
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
import org.apache.hive.jdbc.HiveDriver;
public class HiveCreateDb {
private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
public static void main(String[] args) throws Exception {
// Register driver and create driver instance
Class.forName(driverName);
/* try {
Class.forName(driverName);
} catch(ClassNotFoundException e) {
print("Couldn't find Gum");
} */ // get connection
Connection con = DriverManager.getConnection("jdbc:hive://", "", "");
Statement stmt = con.createStatement();
stmt.executeQuery("CREATE DATABASE userdb");
System.out.println("Database userdb created successfully.");
con.close();
}
}
It is giving a runtime error for connecting hive.
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: rwx------
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…