I have similar recipe but with odbc
module: http://code.activestate.com/recipes/578782-printing-list-of-odbc-data-sources/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/env python
# -*- coding: utf8 -*-
__version__ = '$Id: pyodbc_sources.py 1736 2014-01-28 10:36:41Z mn $'
# shows ODBC data sources with driver info
# author: Michal Niklas
import pyodbc
def show_odbc_sources():
sources = pyodbc.dataSources()
dsns = sources.keys()
dsns.sort()
sl = []
for dsn in dsns:
sl.append('%s [%s]' % (dsn, sources[dsn]))
print('\n'.join(sl))
if __name__ == '__main__':
show_odbc_sources()
|