- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2023 11:57 AM
Hi Everyone,
I was trying to connect to Oracle Instance from Databricks cluster and it is giving below error:
java.sql.SQLTimeoutException: ORA-12170: Cannot connect. TCP connect timeout of 30000ms for host xx.x.x.*** port 1521. (CONNECTION_ID=CgM7V7UBQDSzltL/SWk9LA==)
I have tried checking the port 1521 is listening mode or not using below:
netstat -aon
and State is Listening.
Also I have ojdbc8.jar in the libraries of the running cluster.
Below is the code template I am using:
jdbcHostname = "Your Host Name"
jdbcPort = 1521
jdbcDatabase = "DB Service Name"
jdbcUsername = "hr"
jdbcPassword = "hr"
jdbcUrl = "jdbc:oracle:thin:@//" + jdbcHostname + ":" + str(jdbcPort) + "/" + jdbcDatabase
# Define connection properties
connectionProperties = {
"user": jdbcUsername,
"password": jdbcPassword,
"driver": "oracle.jdbc.driver.OracleDriver"
}
# Load a table from the Oracle database
df = spark.read.jdbc(url=jdbcUrl, table="employees", properties=connectionProperties)
Please help me with your expertise to solve this.
Thanks and Regards,
Satya
- Labels:
-
Cluster
-
Databricks Cluster
-
Oracle