Spark-The-Definitive-Guide icon indicating copy to clipboard operation
Spark-The-Definitive-Guide copied to clipboard

Error while connecting to Databases in DataBrick Community Edition on Cloud

Open joshipm opened this issue 5 years ago • 4 comments

Hi, I have downloaded repository and I was able to execute and practice all example . But when I am trying to execute examples related to SQL data source from Chapter 9 Data Source I am getting following error. I don't have any clue on what to do so please guide me. Thanks in advance. Error"Java.sql.SQLException: path to '/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db': '/databricks-datasets' does not exist"

Path do exists when I run %fs ls and I get following

dbfs:/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db

Following are parameters

driver = "org.sqlite.JDBC" path = "/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db" url = "jdbc:sqlite:" + path tablename = "flight_info"

joshipm avatar Aug 19 '20 18:08 joshipm

Hi,

i think path should be /dbfs/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db

Thanks & Regards, Hitesh Tiwari

On Wed, Aug 19, 2020 at 8:43 PM joshipm [email protected] wrote:

Hi, I have downloaded repository and I was able to execute and practice all example . But when I am trying to execute examples related to SQL data source from Chapter 9 Data Source I am getting following error. I don't have any clue on what to do so please guide me. Thanks in advance. Error"Java.sql.SQLException: path to '/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db': '/databricks-datasets' does not exist"

Path do exists when I run %fs ls and I get following

dbfs:/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db

Following are parameters

driver = "org.sqlite.JDBC" path = "/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db" url = "jdbc:sqlite:" + path tablename = "flight_info"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/databricks/Spark-The-Definitive-Guide/issues/60, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACV2AHNVDLOUDIEV4FHS7ETSBQMNRANCNFSM4QFHW4HQ .

hiteshtiwari avatar Aug 19 '20 20:08 hiteshtiwari

Hi , Just tried doesn’t work.   I assume you want to include that in double quotes. RegardsPrasad Sent from Mail for Windows 10 From: hiteshtiwariSent: Wednesday, August 19, 2020 4:42 PMTo: databricks/Spark-The-Definitive-GuideCc: joshipm; AuthorSubject: Re: [databricks/Spark-The-Definitive-Guide] Error while connecting to Databases in DataBrick Community Edition on Cloud (#60) Hi,i think path should be*/dbfs/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db*Thanks & Regards,Hitesh TiwariOn Wed, Aug 19, 2020 at 8:43 PM joshipm wrote:> Hi,> I have downloaded repository and I was able to execute and practice all> example . But when I am trying to execute examples related to SQL data> source from Chapter 9 Data Source I am getting following error. I don't> have any clue on what to do so please guide me. Thanks in advance.> Error"Java.sql.SQLException: path to> '/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db':> '/databricks-datasets' does not exist">> Path do exists when I run %fs ls and I get following>>> dbfs:/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db>> Following are parameters>> driver = "org.sqlite.JDBC" path => "/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db"> url = "jdbc:sqlite:" + path tablename = "flight_info">> —> You are receiving this because you are subscribed to this thread.> Reply to this email directly, view it on GitHub> , or> unsubscribe> > .>—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 

joshipm avatar Aug 19 '20 21:08 joshipm

did this work for you? i tried all options and it it is failing.

driver = "org.sqlite.JDBC" path = "/dbfs/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db" url = "jdbc:sqlite:" + path tablename = "flight_info"

dbDataFrame = spark.read.format("jdbc").option("url", url).option("dbtable", tablename).option("driver", driver).load()

Py4JJavaError: An error occurred while calling o570.load. : java.sql.SQLException: path to '/dbfs/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db': '/dbfs/databricks-datasets' does not exist at org.sqlite.core.CoreConnection.open(CoreConnection.java:192) at org.sqlite.core.CoreConnection.(CoreConnection.java:76) at org.sqlite.jdbc3.JDBC3Connection.(JDBC3Connection.java:24) at org.sqlite.jdbc4.JDBC4Connection.(JDBC4Connection.java:23) at org.sqlite.SQLiteConnection.(SQLiteConnection.java:45) at org.sqlite.JDBC.createConnection(JDBC.java:114) at org.sqlite.JDBC.connect(JDBC.java:88)

bj9306 avatar Nov 30 '20 15:11 bj9306

i even tried with below

driver = "org.sqlite.JDBC" path = "/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db" url = "jdbc:sqlite:" + path tablename = "flight_info"

dbDataFrame = spark.read.format("jdbc").option("url", url).option("dbtable", tablename).option("driver", driver).load()

but similar error.

Py4JJavaError: An error occurred while calling o589.load. : java.sql.SQLException: path to '/databricks-datasets/definitive-guide/data/flight-data/jdbc/my-sqlite.db': '/databricks-datasets' does not exist at org.sqlite.core.CoreConnection.open(CoreConnection.java:192) at org.sqlite.core.CoreConnection.(CoreConnection.java:76) at org.sqlite.jdbc3.JDBC3Connection.(JDBC3Connection.java:24) at org.sqlite.jdbc4.JDBC4Connection.(JDBC4Connection.java:23) at org.sqlite.SQLiteConnection.(SQLiteConnection.java:45) at org.sqlite.JDBC.createConnection(JDBC.java:114) at org.sqlite.JDBC.connect(JDBC.java:88)

bj9306 avatar Nov 30 '20 15:11 bj9306