473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

configuring ODBC DSN with a python script

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
4 3250
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marc Ederis | last post by:
Hello, I'm trying to create an executable with py2exe, and it uses the odbc module. The script runs fine until I use py2exe on it and run the ..exe. Then I get: -- Traceback (most recent...
0
by: test test | last post by:
Hello Python user, I've read your mail and analysed the problem. The testing i've done was with windows xp pro. First thin i have seen, was that you tried to open an existing registry...
7
by: Chris | last post by:
Hello, I posted a while back about a newbie database question and got a lot of great help here. My script that I am creating has come a long way (For me!) and almost does what I need it too. I...
3
by: Joe | last post by:
Python 2.4 Windows XP SP2 MS Access 2000 mx.ODBC 2.0.7 Problem data truncation occuring (here's the actual error message): mxODBC.Warning: ('01004', 5, ' String data, right truncated on...
13
by: Graham | last post by:
I need a SQL Server or ODBC package for Python. Can anyone help please? Have search the Python packages under Database and there is no reference to either SQL Server or ODBC. Thanks Graham
10
by: callmebill | last post by:
I'm getting my feet wet with making Python talk to MySQL via ODBC. I started on Windows, and it went smoothly enough due to the ODBC stuff that apparently is native to Python at least on windows...
10
by: Ed Stevens | last post by:
A tale of woe, and a question . . . Last week my boss said to me "we've installed DB2 Connect on this Solaris box. Make it work." Now, I've barely seen DB2 Connect on Windows, having fumbled...
5
by: dananrg | last post by:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g: import dbi, odbc ....and it seems to meet my needs. I'd rather use a module that comes...
2
by: Greg Corradini | last post by:
Hello All, A few weeks ago, I wrote two scripts using mx.ODBC on an Access DB. Among other things, both scripts create new tables, perform a query and then populate the tables with data in a...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.