Support Questions

Find answers, ask questions, and share your expertise

Sqoop connection to Oracle from Sandbox gives error

avatar
Explorer

Hi All,

I have installed HDP 2.5 virtual sandbox and was able to run HDFS commans and create some hive tables.

I'm now trying to connect to oracle database and sqoop some tables. I have done the prepreq steps like bringing in ojdbc jar and placing in the lib directory.

My Oracle XE edition database is running on my localhost and Hadoop as you are aware on vitual machine. I'm trying to run the below command but throws the following error:

sqoop list-tables --connect jdbc:oracle:thin@127.0.0.1:1521/xe --username hr --password xxxxx

Error:

Please set $ACCUMULO_HOME to the root of your Accumulo installation. 17/04/01 18:09:36 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.0.0-1245 17/04/01 18:09:37 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 17/04/01 18:09:37 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled. 17/04/01 18:09:37 INFO manager.SqlManager: Using default fetchSize of 1000 17/04/01 18:09:37 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.NullPointerException java.lang.NullPointerException at org.apache.sqoop.manager.OracleManager.listTables(OracleManager.java:760) at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49) at org.apache.sqoop.Sqoop.run(Sqoop.java:147) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:225) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234) at org.apache.sqoop.Sqoop.main(Sqoop.java:243)

Can someone please help me if I'm missing any additional configuration.

1 ACCEPTED SOLUTION

avatar
Master Mentor

@venkat dukkipati

Sometimes this NullPointerException occurs when the DB instance host/port are not accessible.

So can you please check if the Oracle instance is listening to the same port?

# telnet 127.0.0.1 1521
OR
# netstat -tnlpa | grep 1521

.

Also try passing the oracle jdbc driver class name as argument to sqoop command:

--driver oracle.jdbc.OracleDriver 

.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

@venkat dukkipati

Sometimes this NullPointerException occurs when the DB instance host/port are not accessible.

So can you please check if the Oracle instance is listening to the same port?

# telnet 127.0.0.1 1521
OR
# netstat -tnlpa | grep 1521

.

Also try passing the oracle jdbc driver class name as argument to sqoop command:

--driver oracle.jdbc.OracleDriver 

.

avatar
Explorer

Hi Sensharma,

Thank you for replying, I tried telnet from virtual box it throwed below error:

[root@sandbox ml-100k]# telnet 127.0.0.1 1521 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused

as my Oracle xe is on local host but Im trying to connect through sqoop from my virtual machine, I;m wondering if I have to do any additional configuration.

Any help would be appreciated.

avatar
Master Mentor
@venkat dukkipati

As you are not able to connect to port 1521 (even using telnet)

So i am suspecting either your Oracle instance is not listening on this port or it might be bound to some other network interface apart from 127.0.0.1.

Please check oracle logs to make sure you are able to connect to it.

List the ports opened by Oracle Process to see if port 1521 is opened or not?

# netstat -tnlpa | grep $ORACLE_PID

.

avatar
Master Mentor

@venkat dukkipati

Also in your connection URL there is a ":" symbol missing after "jdbc:oracle:thin"

Correct URL as following:

 --connect jdbc:oracle:thin:@127.0.0.1:1521/xe

.

avatar
Explorer

Thank you Jay, it is actually listening on different network interface. Thank you very much.