By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,630 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,630 IT Pros & Developers. It's quick & easy.

configuring ODBC DSN with a python script

P: n/a
I am building an application which, unfortunately, *must* use an
access db. The users will have the relevane mdb file installed on
their system. As part of the installer. Now, the part I am stuck on is
how do I configure the ODBC dsn without having the user open up the
ODBC control panel which will in all honestly just scare and confuse
them. ;)
Has anyone approached this problem before? What did you do?
Thanks!!
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Jani Yusef <ja**@persian.com> pisze:
I am building an application which, unfortunately, *must* use an
access db. The users will have the relevane mdb file installed on
their system. As part of the installer. Now, the part I am stuck on is
how do I configure the ODBC dsn without having the user open up the
ODBC control panel which will in all honestly just scare and confuse
them. ;)


Use ADO -- the connection structure is much more straightforward.

--
Jarek Zgoda
Unregistered Linux User #-1
http://www.zgoda.biz/ JID:zgoda-a-chrome.pl http://zgoda.jogger.pl/
Jul 18 '05 #2

P: n/a
On 4 Feb 2004 11:09:52 -0800, ja**@persian.com (Jani Yusef) wrote:
I am building an application which, unfortunately, *must* use an
access db. The users will have the relevane mdb file installed on
their system. As part of the installer. Now, the part I am stuck on is
how do I configure the ODBC dsn without having the user open up the
ODBC control panel which will in all honestly just scare and confuse
them. ;)
Has anyone approached this problem before? What did you do?
Thanks!!


Most drivers let you pass this in at runtime by building a string with
a number of key/value parameters. With Access, the magic one
is Dbq which refers to the file name. This works for me....
import mx.ODBC.Windows
dc = mx.ODBC.Windows.DriverConnect
conn = dc("Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\\mydir\\myfile.mdb;Uid=Admin;Pwd=
;") cur = conn.cursor()
cur.execute('select count(*) from Codes')
cur.fetchall() [(1144,)]

- Andy Robinson

p.s. Steve Holden tipped me of
Jul 18 '05 #3

P: n/a
Do some research on internet with 'ODBC connection string', It's
possible to access to a mdb database directly without using the
ODBC control panel.You have to open your database with a
connection string like that:

Driver={Microsoft Access Driver
(*.mdb)};Dbq=c:\somepath\mydb.mdb;Uid=the_user;Pwd =the_password

JYV

"Jani Yusef" <ja**@persian.com> a écrit dans le message de
news:d3**************************@posting.google.c om...
I am building an application which, unfortunately, *must* use an
access db. The users will have the relevane mdb file installed on
their system. As part of the installer. Now, the part I am stuck on is
how do I configure the ODBC dsn without having the user open up the
ODBC control panel which will in all honestly just scare and confuse
them. ;)
Has anyone approached this problem before? What did you do?
Thanks!!

Jul 18 '05 #4

P: n/a
He is a good site about that

http://www.able-consulting.com/ADO_Conn.htm

JYV

"Jani Yusef" <ja**@persian.com> a écrit dans le message de
news:d3**************************@posting.google.c om...
I am building an application which, unfortunately, *must* use an
access db. The users will have the relevane mdb file installed on
their system. As part of the installer. Now, the part I am stuck on is
how do I configure the ODBC dsn without having the user open up the
ODBC control panel which will in all honestly just scare and confuse
them. ;)
Has anyone approached this problem before? What did you do?
Thanks!!

Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.