cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Invalid port error when trying to read from PlanetScale MySQL databse

190809
Contributor

Using the code below I am attempting to connect to a PlanetScale MySQL database. I get the following error: java.sql.SQLException: error parsing url : Incorrect port value. However the port is the default 3306, and I have used the correct url based on the PlanetScale documentation, and other members of my team can connect to it with this url using other platforms. Is Databricks doing something else here that I can't see?

remote_table = (spark.read

.format("jdbc")\

.option("driver", driver)\

.option("url", url)\

.option("dbtable", table)\

.option("user", username)\

.option("password", passwd)\

.option("ssl", True) \

.option("sslmode", "require" ) \

.option("sslcert", "dbfs:/mnt/folder/admin/client-cert.pem")\

.option("sslkey", "dbfs:/mnt/folder/admin/client-key.pem" )\

.load()

)

2 REPLIES 2

Pat
Honored Contributor III

HI @Rachel Cunninghamโ€‹ ,

maybe you can share your `driver` and `url` value (masked)?

driver = "org.mariadb.jdbc.Driver"

url = f"jdbc:mysql://{user}:{password}@{database_host}/{database_name}?sslaccept=strict"

The PlanetScale url does not require the host value in the url string and is set to 3306 as default. I have tried adding it and am met with an invalid url error.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group