All,
I can create a connection as follows and it works but I think it is best to
have a connection class that opens and closes. I create the connection class
as outline below. However, it does not work - meaning that it does not return
a connection rather it returns
<__main__.modelingdb at 0x40dfbb0>
Any help getting the connection class to work is greatly appreciated.
Glenn
model_prod_conn = pyodbc.connect(
driver = '{ODBC Driver 13 for SQL Server}',
server = 'foo',
database = 'foo',
username = 'foo',
password = 'foo',
trusted_connection = 'yes')
class modelingdb(object):
def __init__(self):
self._db_connection = pyodbc.connect(
driver = '{ODBC Driver 13 for SQL Server}',
server = 'foo',
database = 'foo',
username = 'foo',
password = 'foo',
trusted_connection = 'yes')
self._db_cur = self._db_connection.cursor()
def __del__(self):
self._db_connection.close()
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor