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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register 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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors