简体   繁体   English

无法将Spark数据集持久保存到OrientDB

[英]Not able to persist Spark data set to orientdb

I am trying to fetch data from sql server database and created a spark dataset. 我试图从SQL Server数据库中获取数据并创建一个Spark数据集。 When i persisting dataset to orientdb, not able to do that. 当我将数据集持久存储到orientdb时,无法做到这一点。

Getting below error 低于错误

Exception in thread "main" java.lang.RuntimeException: Connection Exception Occurred: Error on opening database 'jdbc:orient:REMOTE:localhost/test' 线程“主”中的异常java.lang.RuntimeException:发生连接异常:打开数据库“ jdbc:orient:REMOTE:localhost / test”时出错

Here is my code: 这是我的代码:

    Map<String, String> options = new HashMap<>();
    options.put("driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
    options.put("url", "jdbc:sqlserver://localhost:1433;databaseName=sample");
    options.put("user", "username");
    options.put("password", "password");    

    DataFrameReader jdbcDF = spark.read().format("jdbc").options(options);
    Dataset<Row> tableDataSet = jdbcDF.option("dbtable", "Table1").load();
    tableDataSet.createOrReplaceTempView("TEMP_V");
    Dataset<Row> tableDataset1 = spark.sql("SELECT ID AS DEPT_ID, NAME AS DEPT_NAME  FROM TEMP_V");        
    tableDataset1.write().format("org.apache.spark.orientdb.graphs")
            .option("dburl", "jdbc:orient:remote:localhost/test")
            .option("user", "root")
            .option("password", "root")
            .option("spark", "true")
            .option("vertextype", "DEPARTMENT")
            .mode(SaveMode.Overwrite)
            .save();

At the moment of writing the orientdb's jdbc driver isn't able to persist a spark dataset. 目前,orientdb的jdbc驱动程序无法持久保存spark数据集。 It should be patched to improve shark compatibility . 应该打补丁以提高鲨鱼的兼容性。 It is, although, able to read from orientdb and load a dataset. 但是,它能够从orientdb中读取并加载数据集。 Please open an issue. 请打开一个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM