# Things you may need to change:
# - classPath (This needs to Point to the HANA Client JDBC Driver)
# - jdbcDriver (This should remain the same with the HANA Client JDBC driver)
# - hdbuserstore Key, this is the preferred way to connect securely to HANA
# - SAP HANA Host & port name after jdbc:sap://
# - username (HANA DB User)
# - password (HANA DB User Password)
# - dbGetQuery (Change the Select Query, here I selected a 10% Sample of the CENSUS table in my own schema)
if (!require("RJDBC")) {
install.packages("RJDBC",repos="http://cran.rstudio.com/")
}
library("RJDBC")
jdbcDriver <- JDBC(driverClass="com.sap.db.jdbc.Driver",
classPath=/Applications/sap/hdbclient/ngdbc.jar")
jdbcConnection <- dbConnect(jdbcDriver, "jdbc:sap:", key="SDI_MONSOON")
jdbcConnection <- dbConnect(jdbcDriver,
"jdbc:sap://ukhana.mo.sap.corp:30015/?autocommit=false"
,"username"
,"password")
result <- dbGetQuery(jdbcConnection, "select * from CENSUS TABLESAMPLE SYSTEM (10)")
print(result)
dbDisconnect(jdbcConnection)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
6 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |