Thanks Felix,
It worked with spark class path variable as follows :
SPARK_CLASSPATH=postgresql-9.3-1102-jdbc41.jar

I think it should be working with driver class path.

Thanks
Jason

On 21 April 2015 at 22:27, Felix C <felixcheun...@hotmail.com> wrote:

> 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" <jaes...@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)
>
> -----------------------------
>

Reply via email to