0

I have a sqoop script which ingests data from SAP HANA to Hive. The sqoop scripts runs fine when I give password as argument "--password Password$$", but to secure the password , I put it in a file called sap.password and used argument"--password-file /dev/configs/sap.password", But the sqoop script returns an execption .

Below is my sqoop script and exception occured:

sqoop import 
--connect jdbc:sap://hostname?currentschema=SCHEMA_REF 
--driver com.sap.db.jdbc.Driver 
--username SERVICE_ACCOUNT 
--password-file /dev/configs/sap.password 
--table TABLE1
--hive-import 
--hive-overwrite 
--hive-database cdc_stg 
--hive-table HIVE_TABLE1
--as-parquetfile 
--m 1

Exception that I get is (I'm sure the credentials are correct):

9/11/14 05:47:08 ERROR manager.SqlManager: Error executing statement:
com.sap.db.jdbc.exceptions.jdbc40.SQLInvalidAuthorizationSpecException: [10]: authentication failed
 com.sap.db.jdbc.exceptions.jdbc40.SQLInvalidAuthorizationSpecException: [10]: authentication failed
 at com.sap.db.jdbc.exceptions.jdbc40.SQLInvalidAuthorizationSpecException.createException(SQLInvalidAuthorizationSpecException.java:40)
 at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:290)
 at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateDatabaseException(SQLExceptionSapDB.java:174)
 at com.sap.db.jdbc.packet.ReplyPacket.buildExceptionChain(ReplyPacket.java:100)
 at com.sap.db.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:1141)
 at com.sap.db.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:888)
 at com.sap.db.util.security.AbstractAuthenticationManager.connect(AbstractAuthenticationManager.java:43)
 at com.sap.db.jdbc.ConnectionSapDB.openSession(ConnectionSapDB.java:586)
 at com.sap.db.jdbc.ConnectionSapDB.doConnect(ConnectionSapDB.java:436)
 at com.sap.db.jdbc.ConnectionSapDB.<init>(ConnectionSapDB.java:195)
 at com.sap.db.jdbc.ConnectionSapDBFinalize.<init>(ConnectionSapDBFinalize.java:13)
 at com.sap.db.jdbc.Driver.connect(Driver.java:255)
 at java.sql.DriverManager.getConnection(DriverManager.java:664)
 at java.sql.DriverManager.getConnection(DriverManager.java:247)
 at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:903)
 at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)
 at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:762)
 at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:785)
 at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:288)
 at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:259)
 at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:245)
 at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:333)
 at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1879)
 at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1672)
 at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
 at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:515)
 at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:633)
 at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
 at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
 at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
 at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
 at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
 at org.apache.sqoop.Sqoop.main(Sqoop.java:251)
19/11/14 05:47:08 ERROR tool.ImportTool: Import failed: java.io.IOException: No columns to generate for ClassWriter
 at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1678)
 at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
 at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:515)
 at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:633)
 at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
 at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
 at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
 at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
 at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
 at org.apache.sqoop.Sqoop.main(Sqoop.java:251)
John Thomas
  • 212
  • 3
  • 21

2 Answers2

1

I suspect the password file might be created with newline characters since --password works fine and the only difference or change made is conversion to using a password file.

Can you please re-create the password file using the sqoop docs warning clause stated below.

Reference: SqoopUserGuide

Sqoop will read the entire content of the password file and use it as a password. This will include any trailing white space characters such as newline characters that are added by default by most of the text editors. You need to make sure that your password file contains only characters that belong to your password. On the command line, you can use command echo with switch -n to store password without any trailing white space characters.

Ex: To store password secret use below.

echo -n "secret" > password.file

Also instead of sqoop import try list-databases or list-tables or eval for testing the connection with the password file.

yammanuruarun
  • 403
  • 3
  • 9
0

Please check password file permissions. From Sqoop docs:

You should save the password in a file on the users home directory with 400 permissions

Iskuskov Alexander
  • 4,077
  • 3
  • 23
  • 38