Hi @Tony Sโ , This article mentioned all the steps required to establish a successful connection with the database using Python.
However, you can try this code :-
df.write.format("jdbc") \
.option("url", dbServerJdbcUrl) \
.option("user", username) \
.option("password", password) \
.option("driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver") \ # or "oracle.jdbc.driver.OracleDriver" for Oracle
.option("dbtable", "your_table_name") \
.mode('overwrite') \
.save()
Make sure you have the necessary dependencies and libraries imported to use the write method with JDBC in PySpark.