Reputation: 113
When I'm trying to connect to external Oracle DB from AWS Glue using JDBC getting below errors. Could some one help on this issue?
Driver code using is below:
test_df = spark.read.format('jdbc').options(url='jdbc:oracle:thin:username/password@//myhostname:1521/servicename', dbtable="test", driver='oracle.jdbc.driver.OracleDriver').load()
Errors logs are below:
py4j.protocol.Py4JJavaError: An error occurred while calling o65.load.
: java.sql.SQLRecoverableException: IO Error: Unknown host specified at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:280)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:214)
at java.lang.Thread.run(Thread.java:748)
Thanks, Srini
Upvotes: 1
Views: 3526
Reputation: 7265
It seems like you can't resolve the hostname you specify in to the command. Check this line:
: java.sql.SQLRecoverableException: IO Error:
Unknown host
specified at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
You can use nslookup
or dig
command to check if the hostname is resolved like:
nslookup hostname
dig hostname
If you do not get IP as answer please correct you hostname, /etc/hosts
record or DNS record
All those tests and updates need to be run on the host where your code is running!
Edit1: If you do not have control on the host where your code is running you can:
Upvotes: 1