Establish JDBC Connection in R through single sign-on

0 votes

I am currently trying to connect to an Amazon Web Service database through the RJDBC package within R.

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.

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

Sep 12, 2018 in AWS by bug_seeker
• 15,510 points
2,478 views

1 answer to this question.

0 votes

You can certainly connect to databases with RJDBC using Single Sign-On (SSO). Here's an example how you could do so with Okta SSO and 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")
answered Sep 12, 2018 by Priyaj
• 58,020 points

Related Questions In AWS

0 votes
2 answers

How to access files in S3 bucket from R?

You can take a look at the ...READ MORE

answered Aug 10, 2018 in AWS by Deepthi
• 300 points
6,617 views
0 votes
1 answer

Can't find class CognitoUserPoolsSignInProvider: Issue with Sign In integration

CognitoUserPoolsSignInProvider is ditributed as part of aws-android-sdk-auth-userpools library. Please import ...READ MORE

answered Sep 28, 2018 in AWS by Priyaj
• 58,020 points
930 views
0 votes
1 answer
0 votes
1 answer

How to retrieve column names from java.sql.ResultSet?

You may refer the below code: ResultSet ...READ MORE

answered Jul 4, 2018 in Java by sophia
• 1,400 points
2,865 views
0 votes
1 answer

Find Oracle JDBC driver in Maven repository

Download the jar and place it in ...READ MORE

answered Sep 26, 2018 in Java by Daisy
• 8,140 points
3,278 views
0 votes
1 answer

Accessing connection from different class in Java / MySQL?

You should just instantiate DoComms with every ...READ MORE

answered Nov 14, 2018 in Database by nirvana
• 3,130 points
1,944 views
0 votes
1 answer

Error while connecting to Hive using Java JDBC

Use ​org.apache.hive.jdbc.HiveDriver as your driver ...READ MORE

answered Nov 22, 2018 in Big Data Hadoop by Omkar
• 69,220 points
1,846 views
+2 votes
1 answer

How to Use Amazon AWS Credentials to Access/Query Tables in AWS RDS Instance through Mobile App

You should make your backend functions to ...READ MORE

answered Aug 28, 2018 in AWS by Priyaj
• 58,020 points
1,257 views
+1 vote
1 answer

How to authenticate session in application running on Beanstalk with boto3

The recommended way of managing credentials used ...READ MORE

answered Aug 28, 2018 in AWS by Priyaj
• 58,020 points
1,667 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP