11-23-2022 10:32 PM
Hi all,
I've just encountered with this issue. Before I launched an My SQL database in RDS of AWS after use this simple code to create connection to it but it all fails with this error.
Is there any additional step? or could anyone can take a look on it!
Thank you very much!
Best Regard,
Jensen
11-24-2022 07:49 AM
Hi @Jensen Ackles ,
clearly you have put wrong jdbc connection. We can still see it in the logs.
Try something like this:
url="jdbc:mysql://some-instance.rds.amazonaws.com/<database_name>"
here is also example with driver option:
spark docs: https://spark.apache.org/docs/latest/sql-data-sources-jdbc.html
by the way, congratulations of achieving TOP 5 contributor in the databricks community in such a short time.
Thanks,
Pat.
11-24-2022 07:49 AM
Hi @Jensen Ackles ,
clearly you have put wrong jdbc connection. We can still see it in the logs.
Try something like this:
url="jdbc:mysql://some-instance.rds.amazonaws.com/<database_name>"
here is also example with driver option:
spark docs: https://spark.apache.org/docs/latest/sql-data-sources-jdbc.html
by the way, congratulations of achieving TOP 5 contributor in the databricks community in such a short time.
Thanks,
Pat.
11-24-2022 08:04 AM
@Pat Sienkiewicz thank you very much. I very happy to help people solve the problem also let them help me too. 😀
03-30-2023 11:40 AM
Hello,
It looks issue with JDBC URL. When I am trying to access the Azure SQL database. I was facing the same issue. So I have created JDBC URL as below and it went well.
jdbc:sqlserver://<serverurl>:1433;database=<databasename>;user=<username>@<servername>;password=<password>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
db_user = "XXXXXXX"
db_password = "XXXXXXX"
db_jdbc_url = "jdbc:sqlserver://<serverurl>:1433;database=<databasename>;user=<db_user>@<servername>;password=<db_password>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"
def datahub_db_config(query):
queryresult = (spark.read.format("jdbc")
.option("url", db_jdbc_url)
.option("query", query).
option("user", db_user)
.option("password",db_password).load()
)
return queryresult
result = datahub_db_config(query="select * from <tablename>")
result = datahub_db_config(query=query)
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