Hello. This is what I have below with the PW altered. I was unsure about how to enter the server name. I tried mcgis_sqlmcgis, sqlmcgis, mcgis\sqlmcgis, mcgis
sqlmcgis. Thanks
import pyodbc
conn = pyodbc.connect('DRIVER={SQL Server};SERVER= mcgis\sqlmcgis ;UID=sa;PWD=trailertrash;Trusted_Connection=yes', autocommit=True)
backup_path = 'C:
Backups-GIS-ToExternal
'
db = "RWSA_GIS"
def backup_db(conn, db, backup_path):
cur = conn.cursor()
try:
cur.execute('BACKUP DATABASE ? TO DISK=?', )
while cur.nextset():
pass
cur.close()
except:
print 'Unable to backup: ' + db
backup_db(conn, db, backup_path)
conn.close()