[英]Establish JDBC Connection in R through single sign-on
I am currently trying to connect to an Amazon Web Service database through the RJDBC package within R. 我当前正在尝试通过R中的RJDBC包连接到Amazon Web Service数据库。
I have all the information about the driver, jarfile & URL needed in order to connect to the database, however the problem occurs with trying to get the username and password as access is given through a single sign-on site for which I get access to all other apps. 我具有连接到数据库所需的有关驱动程序,jarfile和URL的所有信息,但是尝试通过通过我可以访问的单个登录站点进行访问来获取用户名和密码时出现问题所有其他应用。
This is the current code setup I have to obtain connection to the database 这是当前的代码设置,我必须获得与数据库的连接
jdbcConnection <- dbConnect(drv,
URL,
s3_staging_dir=Staging_Dir,
user=getOption("AWSUSER"),
password=getOption("AWSPASS"))
The credentials to access the sign on site itself does not work. 访问站点本身的凭证不起作用。 Is it possible to use another method other than requiring:
除了要求之外,是否可以使用其他方法:
user = <>,
password = <>)
Thanks 谢谢
You can certainly connect to databases with RJDBC using Single Sign-On (SSO). 您当然可以使用单一登录(SSO)使用RJDBC连接到数据库。 Here's an example how you could do so with Okta SSO and Snowflake.
这是一个示例,说明如何使用Okta SSO和Snowflake进行操作。
# load library
library(RJDBC)
# specify driver
jdbcDriver <- JDBC(driverClass="net.snowflake.client.jdbc.SnowflakeDriver",
classPath="/home/<your_username>/R/snowflake-jdbc-3.6.6.jar") # <-- this is where I saved the jar file
# create a connection
# this is the most critical part.
# you have to make sure you enter your SSO path as well as corp username with domain
con <- dbConnect(jdbcDriver, "jdbc:snowflake://company.us-east-1.snowflakecomputing.com/?authenticator=https://your_domain_name.okta.com/",
'username@domain.com', 'password')
# to query data
# at this point, you are good to go. start querying data.
dbGetQuery(con, "select current_timestamp() as now")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.