I have a .ini (configuration file) where I mentioned the server name, database name, username and password with which I can connect my application to MSSQL
self.db = pyodbc.connect('driver={SQL Server};server=homeserver;database=testdb;uid=home;pwd=1234')
the corresponding data mentioned above, the connect statement is now in config.ini `self.configwrite = ConfigParser.RawConfigParser () configread = SafeConfigParser () configread.read ('config.ini')
driver = configread.get('DataBase Settings','Driver') server = str(configread.get('DataBase Settings','Server')) db = str(configread.get('DataBase Settings','Database')) user = str(configread.get('DataBase Settings','Username')) password = str(configread.get('DataBase Settings','Password'))'
How can I pass these variables in pyopbc connection statement
I am tired of this self.db = pyodbc.connect('driver={Driver};server=server;database=db;uid=user;pwd=password')
receiving an error.
source share