尝试使用SSL连接从ORACLE DB导入(SQOOP)表数据到HDFS。
我使用的Sqoop命令如下,
sqoop import -Djavax.net.ssl.trustStore = / app / Wallets / client_wallet / ewallet.p12 -Djavax.net.ssl.trustStoreType = PKCS12 -Djavax.net.ssl.trustStorePassword = WalletPasswd123 --connect jdbc:oracle :thin:@testssl --username test --password test --table APP_INSTANCE
ERROR:
17/06/30 18:43:12 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
17/06/30 18:43:12 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/06/30 18:43:13 DEBUG tool.BaseSqoopTool: Enabled debug logging.
17/06/30 18:43:13 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
17/06/30 18:43:13 DEBUG sqoop.ConnFactory: Loaded manager factory: org.apache.sqoop.manager.oracle.OraOopManagerFactory
17/06/30 18:43:13 DEBUG sqoop.ConnFactory: Loaded manager factory: com.cloudera.sqoop.manager.DefaultManagerFactory
17/06/30 18:43:13 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
17/06/30 18:43:13 INFO manager.SqlManager: Using default fetchSize of 1000
17/06/30 18:43:13 INFO tool.CodeGenTool: Beginning code generation
17/06/30 18:43:13 DEBUG manager.SqlManager: Execute getColumnInfoRawQuery : SELECT t.* FROM APP_INSTANCE AS t WHERE 1=0
17/06/30 18:43:13 DEBUG manager.SqlManager: No connection paramenters specified. Using regular API for making connection.
17/06/30 18:43:14 ERROR manager.SqlManager: Error executing statement: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
的tnsnames.ora:
testssl = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCPS)(HOST = IP )(PORT = 2484))
(CONNECT_DATA = (SERVER = dedicated)(SERVICE_NAME = ORACL)))
sqlnet.ora中:
WALLET_LOCATION=(SOURCE=(METHOD=FILE)
(METHOD_DATA=(DIRECTORY=/app/Wallets/client_wallet)))
SQLNET.AUTHENTICATION_SERVICES = (tcps)
SSL_CIPHER_SUITES = (SSL_RSA_WITH_AES_128_CBC_SHA,SSL_DH_anon_WITH_3DES_EDE_CBC_SHA)
SSL_CLIENT_AUTHENTICATION = FALSE
尝试使用SQLPLUS:
$ sqlplus64 neon_main/bullet@testssl
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jun 30 19:23:58 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
这很好用。但不使用JDBC。
请指出我哪里错了。?
答案 0 :(得分:0)
由于您使用的是TNS名称别名,因此应明确传递-Doracle.net.tns_admin =。此外,JDBC thin不会读取文件sqlnet.ora。因此,需要将这些属性显式传递为连接级属性。
查看SSL with JDBC whitepaper了解详情。