pyodbc remote server connection

0

Dear, I am working on a database in ms access

I make a query locally and everything works well with the module pyodbc I leave the syntax:

conn = pyodbc.connect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\Doron E\Desktop\Test\testdb.accdb;")

I can not find the way to consult a remote server .. someone who is more knowledgeable that could help me ..

thank you very much.

    
asked by Bruno Oviedo 01.03.2018 в 19:13
source

1 answer

0
import pyodbc

server = 'xxxx'

database = 'xxx'

username = 'xx'

password = 'xxx'

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

cursor = cnxn.cursor()
  

The Driver is the connector (access, sql server, etc)

    
answered by 11.05.2018 в 04:32