configuring ODBC DSN with a python script

J

Jani Yusef

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!!
 
J

Jarek Zgoda

Jani Yusef said:
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.
 
A

Andy Robinson

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....
(*.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
 
J

Jean-Yves Vinet

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top