spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naga G <gudurun...@gmail.com>
Subject Re: Oracle Table not resolved [Spark 2.1.1]
Date Mon, 28 Aug 2017 11:55:03 GMT
Not able to find the database name.
ora is the database in the below url ?

Sent from Naga iPad

> On Aug 28, 2017, at 4:06 AM, Imran Rajjad <rajjad@gmail.com> wrote:
> 
> Hello,
> 
> I am trying to retrieve an oracle table into Dataset<Row> using following code
> 
> String url = "jdbc:oracle@localhost:1521:ora";
>   Dataset<Row> jdbcDF = spark.read()
>       .format("jdbc")
>       .option("driver", "oracle.jdbc.driver.OracleDriver")
>       .option("url", url)
>       .option("dbtable", "INCIDENTS")
>       .option("user", "user1")
>       .option("password", "pass1")
>       .load();
>   
>   System.out.println(jdbcDF.count());
> 
> below is the stack trace
> 
> java.lang.NullPointerException
>  at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:72)
>  at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.<init>(JDBCRelation.scala:113)
>  at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:45)
>  at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:330)
>  at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:152)
>  at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:125)
>  at com.elogic.hazelcast_test.JDBCTest.test(JDBCTest.java:56)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498)
>  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>  at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
>  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
>  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> 
> Apparently the connection is made but Table is not being detected. Any ideas whats wrong
with the code?
> 
> regards,
> Imran
> -- 
> I.R

---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscribe@spark.apache.org


Mime
View raw message