_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › JDBC磯

Contents

1 hive JDBC 磯
2 tajo JDBC 磯


1 hive JDBC 磯 #

library("RJDBC")
cp <- c( 
"c:\\hive\\hadoop-common-2.5.2.jar",
"c:\\hive\\commons-logging-1.1.3.jar",
"c:\\hive\\hive-exec-1.0.0.jar",
"c:\\hive\\hive-jdbc-1.0.0.jar",
"c:\\hive\\hive-metastore-1.0.0.jar",
"c:\\hive\\hive-service-1.0.0.jar",
"c:\\hive\\libfb303-0.9.0.jar",
"c:\\hive\\log4j-1.2.16.jar",
"c:\\hive\\slf4j-api-1.7.5.jar",
"c:\\hive\\slf4j-log4j12-1.7.5.jar",
"c:\\hive\\httpclient-4.2.5.jar",
"c:\\hive\\httpmime-4.2.5.jar",
"c:\\hive\\httpcore-4.2.5.jar"
)
.jinit(classpath=cp) 

drv <- JDBC("org.apache.hive.jdbc.HiveDriver", "c:\\hive\\hive-jdbc-1.0.0.jar")
conn <- dbConnect(drv, "jdbc:hive2://10.100.88.221:10000/default")

dbGetQuery(conn, "select * from app_info")

#hive query 襴企 tab 覓語 譯殊伎 .
#r-studio 螳一 朱 れ郁鍵 蠍磯レ 朱 麹 tab 覓語 譯殊伎 .
#sql覓語  碁語襦(;) 覿 .
dbGetQuery(conn, "select
      substring(dt, 1, 8) dt
,     sum(val) val
from test_table               
group by
    substring(dt, 1, 8) 
order by dt
")

2 tajo JDBC 磯 #

0.10.0 覯蟾讌 郁鍵 覓 覯蠏瑚 襷. 語 1.x 覯~
library("RJDBC")
cp <- c( 
"c:\\jdbc3\\commons-cli-1.2.jar",
"c:\\jdbc3\\commons-configuration-1.6.jar",
"c:\\jdbc3\\commons-lang-2.6.jar",
"c:\\jdbc3\\commons-logging-1.1.1.jar",
"c:\\jdbc3\\guava-11.0.2.jar",
"c:\\jdbc3\\hadoop-annotations-2.5.1.jar",
"c:\\jdbc3\\hadoop-auth-2.5.1.jar",
"c:\\jdbc3\\hadoop-common-2.5.1.jar",
"c:\\jdbc3\\hadoop-hdfs-2.5.1.jar",
"c:\\jdbc3\\joda-time-2.3.jar",
"c:\\jdbc3\\log4j-1.2.17.jar",
"c:\\jdbc3\\log4j-over-slf4j-1.7.5.jar",
"c:\\jdbc3\\netty-3.6.6.Final.jar",
"c:\\jdbc3\\protobuf-java-2.5.0.jar",
"c:\\jdbc3\\slf4j-api-1.7.10.jar",
"c:\\jdbc3\\tajo-algebra-0.10.0.jar",
"c:\\jdbc3\\tajo-catalog-client-0.10.0.jar",
"c:\\jdbc3\\tajo-catalog-common-0.10.0.jar",
"c:\\jdbc3\\tajo-catalog-server-0.10.0.jar",
"c:\\jdbc3\\tajo-cli-0.10.0.jar",
"c:\\jdbc3\\tajo-client-0.10.0.jar",
"c:\\jdbc3\\tajo-common-0.10.0.jar",
"c:\\jdbc3\\tajo-core-0.10.0.jar",
"c:\\jdbc3\\tajo-plan-0.10.0.jar",
"c:\\jdbc3\\tajo-pullserver-0.10.0.jar",
"c:\\jdbc3\\tajo-rpc-0.10.0.jar",
"c:\\jdbc3\\tajo-storage-common-0.10.0.jar",
"c:\\jdbc3\\tajo-storage-hbase-0.10.0.jar",
"c:\\jdbc3\\tajo-storage-hdfs-0.10.0.jar")
.jinit(classpath=cp) 

drv <- JDBC("org.apache.tajo.jdbc.TajoDriver", "c:\\jdbc3\\tajo-jdbc-0.10.0.jar")
conn <- dbConnect(drv, "jdbc:tajo://192.168.0.100:26002/default")

dbGetQuery(conn, "select * from test limit 10")
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:54

螻糾鍵 螳. 蠏碁 伎螻 蠏 譴 蟾.