Kettle连接Hive2的问题解决思路

在kettle上当选择好HIVE2连接时候有报错


org.pentaho.di.core.exception.KettleDatabaseException: 

Error occured while trying to connect to the database


Error connecting to database: (using class org.apache.hive.jdbc.HiveDriver)
org/apache/http/client/CookieStore




at org.pentaho.di.core.database.Database.normalConnect(Database.java:428)
at org.pentaho.di.core.database.Database.connect(Database.java:361)
at org.pentaho.di.core.database.Database.connect(Database.java:314)
at org.pentaho.di.core.database.Database.connect(Database.java:302)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseExplorerController.createDatabaseNodes(XulDatabaseExplorerController.java:380)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseExplorerController.init(XulDatabaseExplorerController.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.initialize(AbstractXulDomContainer.java:141)
at org.pentaho.ui.xul.swt.SwtXulRunner$1.run(SwtXulRunner.java:67)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Unknown Source)
at org.eclipse.swt.widgets.Display.syncExec(Unknown Source)
at org.pentaho.ui.xul.swt.SwtXulRunner.initialize(SwtXulRunner.java:64)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseExplorerDialog.open(XulDatabaseExplorerDialog.java:92)
at org.pentaho.di.ui.core.database.dialog.DataOverrideHandler.explore(DataOverrideHandler.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141)
at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43)
at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:138)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:389)
at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:318)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:116)
at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:59)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:464)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.newConnection(SpoonDBDelegate.java:451)
at org.pentaho.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:3017)
at org.pentaho.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:2987)
at org.pentaho.di.ui.spoon.Spoon.access$2400(Spoon.java:338)
at org.pentaho.di.ui.spoon.Spoon$28.widgetDefaultSelected(Spoon.java:5990)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1297)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7801)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9130)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:638)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:151)
Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
Error connecting to database: (using class org.apache.hive.jdbc.HiveDriver)
org/apache/http/client/CookieStore


at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:575)
at org.pentaho.di.core.database.Database.normalConnect(Database.java:410)
... 57 more
Caused by: java.lang.NoClassDefFoundError: org/apache/http/client/CookieStore
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:559)
... 58 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.CookieStore
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

... 62 more




根据以上报错,主要分析最后的报错名称:org/apache/http/client/CookieStore,看来是缺Jar包了,后来想想以前的HiveDrive,就整个把驱动需要的jar包拷贝到了kettle\data-integration\lib下面,这些jar包可以从http://download.csdn.net/detail/hanghangaidoudou/9817665下载



Kettle是一种ETL工具,用于在关系型数据库和Hadoop生态系统之间进行数据导入和转换。要将Kettle导入到Hive,有两种主要思路:直接配置JDBC连接HiveServer2,通过表输入和表输出组件进行转换;或者先将关系型数据库中的表导入到HDFS,再通过HDFS导入Hive表。具体的步骤如下: 第一种方式是直接连接HiveServer2: 1. 配置Hive连接,设置JDBC连接HiveServer2。 2. 将关系型数据库中的表导入到Hive的default库中。 第二种方式是先通过Hadoop File Output组件将关系型数据库中的表导出至HDFS,再导入Hive表中。具体步骤如下: 1. 确认Kettle中的Hadoop集群信息。 2. 将Hadoop集群的配置文件复制到Kettle目录中的hdp26文件夹中。 3. 在Kettle目录中的plugin.properties文件中配置Hadoop使用的配置文件为hdp26。 4. 配置Hadoop File Output组件,选择导出的文件位置、分隔符和字符编码等参数。 5. 文件导出至HDFS后,使用执行SQL脚本组件执行加载命令将数据加载到Hive目标表中。 以上就是将Kettle导入到Hive的两种常用方式。具体选择哪种方式取决于实际情况和需求。在使用Kettle连接Hive时,可以使用HiveJDBC连接字符串,例如"jdbc:hive2://localhost:10000/default"。这样就可以成功将Kettle中的数据导入到Hive中了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [通过kettle将关系型数据库中表导入hive中](https://blog.csdn.net/shenzhibiao/article/details/99205692)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [使用kettle同步数据到hive](https://blog.csdn.net/sxjxrxm/article/details/94573127)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

杨航 AI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值