Publishing Jupyter notebook with SQL connection

68 Views Asked by At

I'm trying to publish a jupyter notebook to Posit (Rstudio) connect with a SQL connection. I've been using pyodbc without any luck.

cnxn = pyodbc.connect('Driver={SQL Server};'
                  'SERVER='+server +';'
                  'DATABASE=' + database +';' 
                  'UID=' + UID + ';'
                  'PWD=' + PWD + ';'
                  'Trusted_Connection=yes;')

I've also tried:

cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};'
                  'SERVER='+server +';'
                  'DATABASE=' + database +';' 
                  'UID=' + UID + ';'
                  'PWD=' + PWD + ';'
                  'Trusted_Connection=yes;')

I was expecting for the connection to work the same way it did on my computer. I know the posit connect server is able to access SQL Server because it's been done in R. What am I missing?

0

There are 0 best solutions below