gpt4 book ai didi

java - 通过掩码更改文件模式错误 (5) : Access is denied

转载 作者:太空宇宙 更新时间:2023-11-04 11:18:49 26 4
gpt4 key购买 nike

我访问了 MySQL 数据库并获取了表。在那之前一切都工作正常。

当我尝试以文本或其他格式保存记录时,出现错误 退出代码异常退出代码=1:“按掩码更改文件模式错误”(5):访问被拒绝。

任何帮助将不胜感激。

object jdbcConnect {
def main(args: Array[String]) {

val url="jdbc:mysql://127.0.0.1:3306/mydb"
val username = "root"
val password = "token_password"
Class.forName("com.mysql.jdbc.Driver").newInstance


//DriverManager.registerDriver(new com.mysql.jdbc.Driver());

val conf = new SparkConf().setAppName("JDB CRDD").setMaster("local[2]").set("spark.executor.memory", "1g")

val sc = new SparkContext(conf)
val myRDD = new JdbcRDD( sc, () =>
DriverManager.getConnection(url,username,password) ,
"select s_Id,issue_date from store_details limit ?, ?",
0, 10, 1, r => r.getString("s_Id") + ", " + r.getString("issue_date"))

myRDD.foreach(println)
myRDD.saveAsTextFile("C:/jdbcrddexamplee")

}
}

错误

17/07/18 11:10:19 ERROR Executor: Exception in task 0.0 in stage 2.0 (TID 2) ExitCodeException exitCode=1: ChangeFileModeByMask error (5): Access is denied.

at org.apache.hadoop.util.Shell.runCommand(Shell.java:582) at org.apache.hadoop.util.Shell.run(Shell.java:479) at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:773) at org.apache.hadoop.util.Shell.execCommand(Shell.java:866) at org.apache.hadoop.util.Shell.execCommand(Shell.java:849) at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:733) at org.apache.hadoop.fs.RawLocalFileSystem$LocalFSFileOutputStream.(RawLocalFileSystem.java:225) at org.apache.hadoop.fs.RawLocalFileSystem$LocalFSFileOutputStream.(RawLocalFileSystem.java:209) at org.apache.hadoop.fs.RawLocalFileSystem.createOutputStreamWithMode(RawLocalFileSystem.java:307) at org.apache.hadoop.fs.RawLocalFileSystem.create(RawLocalFileSystem.java:296) at org.apache.hadoop.fs.RawLocalFileSystem.create(RawLocalFileSystem.java:328)

最佳答案

这似乎是一个权限错误。我的愚蠢...

确保以管理员身份运行任何内容。虽然我建议使用 dataframe 而不是 RDD :D

关于java - 通过掩码更改文件模式错误 (5) : Access is denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45164586/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com