configuring ODBC DSN with a python script
Robert Brewer
fumanchu at amor.org
Fri Feb 6 12:23:24 EST 2004
More information about the Python-list mailing list
Fri Feb 6 12:23:24 EST 2004
- Previous message (by thread): configuring ODBC DSN with a python script
- Next message (by thread): configuring ODBC DSN with a python script
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
omission9 wrote: > "Robert Brewer" <fumanchu at amor.org> wrote in message > news:<mailman.1260.1076005686.12720.python-list at python.org>... > > Jani Yusef wrote: > > > I am building an application which, unfortunately, > > > *must* use an access db... > > > how do I configure the ODBC dsn without having the > > > user open up the ODBC control panel which will in > > > all honesty just scare and confuse them. ;) > > > > I opined: > > > the thought crosses my mind that ODBC entries are merely a lump > > > of registry keys--you might just create or even copy those > > > programatically. That would be my first attempt. > > > > and omission9 added: > > > Below is some code which more or less implements this... > > > > Great work! I knew *someone* must have tried that before. :) > > > > > One thing is that the system dsn created works perfectly > fine but for > > > whatever reason doesn't show up in the odbc control > panel. I am not > > > very well versed in Windows specific programming so am > not sure why > > > that is but would like to know why. Anybody know why that is? > > > > First guess: you need an entry in > > HKEY LOCAL MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources > OK, at the risk of strating to get a little OT....... > That looks to be correct but when I go to modify ODBC Data Sources as > I have with the other reg keys I get an access denied error. Any idea > about that? I don't think it's off-topic, really. It'd be nice IMO to have a stable chunk of code to do this--it won't ever make the Library, but it'd be great to have a complete solution on PyPI. Regarding the error, that's a Windows NT/2k, etc permissions issue. Use regedt32 to examine permissions on registry keys; on my 2k SP4 laptop, the default for that key is that only Administrators and SYSTEM may write that key. One commonly-adopted solution would be to require that only Administrators install your package. Alternately, you could create the keys in HKEY_CURRENT_USER instead of LOCAL_MACHINE. Personally, I would give the deployer the option, either in a config file, or by direct query during install, depending on the application. Robert Brewer MIS Amor Ministries fumanchu at amor.org
- Previous message (by thread): configuring ODBC DSN with a python script
- Next message (by thread): configuring ODBC DSN with a python script
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list