Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. hiveconnection <- dbConnect(drv,
  2. "jdbc:hive2://xxxxx:10001/default",
  3. "xxxxx",
  4. "xxxxx",
  5. ssl="true",
  6. sslTrustStore="mytruststore.jks",
  7. trustStorePassword="xxxxx",
  8. hive.server2.transport.mode="http",
  9. hive.server2.thrift.http.path="gateway/default/hive
  10. )
  11.  
  12. library(rJava)
  13. library(RJDBC)
  14.  
  15. hive.class.path = list.files(path=c('/path/to/build/hivedrivers/'), pattern="jar", full.names=T);
  16. .jinit(classpath=hive.class.path,parameters="")
  17.  
  18. drv <- JDBC("org.apache.hive.jdbc.HiveDriver","hive-jdbc-2.0.0.jar",identifier.quote="`")
  19.  
  20. conn <- dbConnect(drv,
  21. 'jdbc:hive2://myhost:10000/default;ssl=true;sslTrustStore=/path/to/truststore.jks;trustStorePassword=mypassword;',
  22. username,
  23. password
  24. )
  25.  
  26. show_databases <- dbGetQuery(conn, "show databases")
  27. print(show_databases)
  28.  
  29. repositories {
  30. mavenCentral()
  31. }
  32. configurations {
  33. drivers
  34. }
  35. dependencies {
  36. drivers "org.apache.hive:hive-jdbc:2.0.0"
  37. }
  38. task CopyDrivers(type: Copy) {
  39. from configurations.drivers
  40. into "$buildDir/hivedrivers"
  41. }
  42.  
  43. $ gradle CopyDrivers
  44.  
  45. $ BI_HOST=bi4c-xxxxx-master-3.bi.services.bluemix.net
  46. $ openssl s_client -showcerts -connect $BI_HOST:9443 < /dev/null | openssl x509 -outform PEM > certificate
  47. $ rm -f truststore.jks
  48. $ keytool -import -trustcacerts -alias biginsights -file certificate -keystore truststore.jks -storepass mypassword -noprompt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement