您好,您那边代码是怎么写的呢?写入到Oracle需要使用SDX的方式去连接Oracle数据库来写入,不能使用JDBC的方式来连接,
params1.put(FeatureRDDProviderParams.ProviderType.key, "SDX")
def saveOracleFrddData(featureRDD: FeatureRDD):FeatureRDD ={ import java.util val params = new util.HashMap[String, java.io.Serializable]() params.put("dbtype", "oracle") params.put("host", "192.168.111.11") params.put("port", 1521) params.put("schema", "GTCAD") params.put("database", "ORCL") params.put("user", "*****") params.put("passwd", "******") params.put("numPartitions", 64) params.put("partitionField", "OBJECTID") params.put("providerType", "JDBC") params.put("dbtablename","SAVE_FRDD") FeatureRDDProviderFactory(params).save(featureRDD, params, featureRDD.schema.getTypeName) featureRDD }
不使用JDBC的方式连接,可以参考以下代码:
val params1 = new util.HashMap[String, java.io.Serializable]() params1.put(SDXFeatureRDDProviderParams.DBType.key, "oracleplus"); params1.put(SDXFeatureRDDProviderParams.Server.key, "orcl") params1.put(SDXFeatureRDDProviderParams.User.key, "lcx") params1.put(SDXFeatureRDDProviderParams.PassWord.key, "123456") params1.put(FeatureRDDProviderParams.ProviderType.key, "SDX") FeatureRDDProviderFactory(params1).save(mysqlRDD, params1,"L20221101333")