Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

passing securitymechanism=13 parameter in Sqoop command

passing securitymechanism=13 parameter in Sqoop command

New Contributor

Hi,

I have DB2 database in which secutiry mechanism was enabled and we are using Server authentication.

I'm using the sqoop to establish the connection using JDBC with below command and getting error. error says Invalid database URL syntax. so i'm not sure how to pass the parameter.

Can someone please suggest how to precisely pass the securityMechanism in the sqoop CLI.

sqoop list-tables --connect jdbc:db2://xxxxxxxxm11.xxxx.com:50501/xxxmd11:securityMechanism=13 --username xxxxxx--password xxxxxxxxxxxx

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/hdp/2.6.2.0-205/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/usr/hdp/2.6.2.0-205/accumulo/lib/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 18/01/02 21:43:22 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.6.2.0-205 18/01/02 21:43:22 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 18/01/02 21:43:22 INFO manager.SqlManager: Using default fetchSize of 1000 18/01/02 21:43:23 ERROR manager.SqlManager: Error reading database metadata: com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10165][10051][4.19.72] Invalid database URL syntax:jdbc:db2://xxxxxxxxm11.xxxx.com:50501/xxxmd11:securityMechanism=13. ERRORCODE=-4461, SQLSTATE=42815 com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10165][10051][4.19.72] Invalid database URL syntax: jdbc:db2://xxxxxxxxm11.xxxx.com:50501/xxxmd11:securityMechanism=13. ERRORCODE=-4461, SQLSTATE=42815 at com.ibm.db2.jcc.am.b4.a(b4.java:747) at com.ibm.db2.jcc.am.b4.a(b4.java:66) at com.ibm.db2.jcc.am.b4.a(b4.java:93) at com.ibm.db2.jcc.DB2Driver.tokenizeURLProperties(DB2Driver.java:948) at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:413) at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:112) 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:904) at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52) at org.apache.sqoop.manager.SqlManager.listTables(SqlManager.java:539) 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) Caused by: java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(StringTokenizer.java:349) at java.util.StringTokenizer.nextToken(StringTokenizer.java:377) at com.ibm.db2.jcc.DB2Driver.tokenizeURLProperties(DB2Driver.java:936) ... 14 more Could not retrieve tables list from server

2 REPLIES 2
Highlighted

Re: passing securitymechanism=13 parameter in Sqoop command

Rising Star

The connection string looks correct to me. Do you have the license jar in the same directory as the jdbc jar?

Re: passing securitymechanism=13 parameter in Sqoop command

New Contributor

Hi @Benjamin Hopp

Thanks for your response.

yes License Jar is in same dir. Also to let you know for other environment(Stage) where security mechanism is not enabled on DB2 server it is working fine with out passing paramerter. But On Dev DB2 server they have enabled the security mechanism and its not working when i try with securityMechanism=13 option. I'm not sure if i'm passing it correctly and is that is correct way.

ENCRYPTED_USER_PASSWORD_AND_DATA_SECURITY(13)