Python Forum

Full Version: Sample code to connect DB using parameter values
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Need a sample program to connect SQL SERVER DB using parameter file


1) looking for sample code for connecting to DB using parameter file
which DBMS?
SQL SERVER, Sorry for late response

These are the parameters i want to call from a file into the program.

sourceDBDriver
sourceDBBserver
sourceDatabase
userid
password

and i am connecting this way

connect_String = 'Driver={%s}.....................
conn = pyodbc.connect(connect_string)