Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
zukkster
Frequent Visitor

Publishing R visual - ODBC connection string

I have manged to create an R visual in the Desktop that runs a  stored procedure and charts the results. With a lot of trial and error I managed to work out the connection string required in the desktop.

 

con <- odbcDriverConnect( "Driver={SQL Server Native Client 11.0}; Server= ###########; Database=#######; UID=#######; PWD=########")
sql_str <- paste("EXEC contact_density_sent_band ", first_period, ", ", last_period )

strd_prod <- sqlQuery(con, sql_str, rows_at_time=1)

 

If I publish the report, then I get an ODBC connection error. I'm assuming I need to use the Gateway instead of my personal account? Any idea of what the syntax is likely to be to use the Gateway?

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi zukkster,

 

 

Based on your description, you call R ODBC package to access your database in power bi R visual, right? The data you achieved through R ODBC package will not be saved as a dataset in your PBIX file so when you pulish your report there will occur an erro. So I would recommend you to import database data using the built-in power bi ODBC connector and then implement R script in R visual with the dataset in power bi.

 

Regards,

Jimmy Tao

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

Hi zukkster,

 

 

Based on your description, you call R ODBC package to access your database in power bi R visual, right? The data you achieved through R ODBC package will not be saved as a dataset in your PBIX file so when you pulish your report there will occur an erro. So I would recommend you to import database data using the built-in power bi ODBC connector and then implement R script in R visual with the dataset in power bi.

 

Regards,

Jimmy Tao

The data table has hundreds of millions of records. Is importing this volume of data into Power BI going to be feasable? I've already tried to do this using DAX and while I can make it work, it takes 50 seconds to update the data when you change the date slices - compared to 2 seconds when you use R to send a strored procedure call to the table using ODBC.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.