spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix C <felixcheun...@hotmail.com>
Subject RE: Can't find postgresql jdbc driver when using external datasource
Date Tue, 21 Apr 2015 12:27:33 GMT
It works with --driver-class-path?

Please see https://eradiating.wordpress.com/2015/04/17/using-spark-data-sources-to-load-data-from-postgresql/

--- Original Message ---

From: "JaeSung Jun" <jaesjun@gmail.com>
Sent: April 21, 2015 1:05 AM
To: dev@spark.apache.org
Subject: Can't find postgresql jdbc driver when using external datasource

Hi,

I tried to get external data base table running sitting on postgresql.
i've got java.lang.ClassNotFoundException even if i added driver jar using
--jars option like followings :

is it class loader hierarchy problem or any idea?

thanks

-----------------

spark-sql --jars ../lib/postgresql-9.4-1200.jdbc41.jar

spark-sql> CREATE TEMPORARY TABLE uusr

         > USING org.apache.spark.sql.jdbc

         > OPTIONS (

         > url
"jdbc:postgresql://localhost/spark_db?user=postgres&password=password",

         > driver "org.postgresql.Driver",

         > dbtable "uusr"

         > );

..

java.lang.ClassNotFoundException: org.postgresql.Driver

at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:191)

 at
org.apache.spark.sql.jdbc.DefaultSource.createRelation(JDBCRelation.scala:97)

-----------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org


Mime
View raw message