Support Questions
Find answers, ask questions, and share your expertise

Sqoop import jdbc:sqlserver connection with JavaKerberos failed

Sqoop import jdbc:sqlserver connection with JavaKerberos failed

New Contributor

Hello, I am trying to connect to MSSQL with sqoop jdbc javakerberos option. The command below returns result successfully.

sqoop eval \
--connect "jdbc:sqlserver://FQDN:1433;databasename=dbName;integratedSecurity=true;authenticationScheme=JavaKerberos;"\
--query "select top 10 * FROM dbo.tableName"

On the other hand, I'm getting error with the below command.

sqoop import \
--connect "jdbc:sqlserver://FQDN:1433;databasename=databaseName;integratedSecurity=true;authenticationScheme=JavaKerberos;" \
--query "select top 10 * FROM dbo.tableName WHERE 1=1 AND \$CONDITIONS" \
--target-dir /user/root/sqoop \
-m 1 \
--delete-target-dir
  • Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Integrated authentication failed. ClientConnectionId:08e00b0d-a2f6-4e7a-b7c5-9a7881fd2c82
  • at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2435)
  • at com.microsoft.sqlserver.jdbc.KerbAuthentication.intAuthInit(KerbAuthentication.java:135)
  • Caused by: java.security.PrivilegedActionException: GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
  • at java.security.AccessController.doPrivileged(Native Method)


To solve this issue, I created a new jaas.conf file in tmp directory.

SQLJDBCDriver {
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=false
useKeyTab=true
storeKey=true
keyTab="/etc/security/keytabs/hdfs.headless.keytab"
principal=hdfs-archieve@DN;
};

I tried to pass jaas.conf file to jdbc driver, but received another error : No LoginModules configured for /tmp/my_jaas.conf

sqoop import \
--connect "jdbc:sqlserver://FQDN:1433;databasename=databaseName;integratedSecurity=true;authenticationScheme=JavaKerberos;jaasConfigurationName=/tmp/my_jaas.conf" \
--query "select top 10 * FROM dbo.tableName WHERE 1=1 AND \$CONDITIONS" \
--target-dir /user/root/sqoop \
--delete-target-dir \
-m 1


Any help will be very much appreciated. Thanks in advance :)