473,597 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3260
Jani Yusef <ja**@persian.c om> 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.co m (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={Mic rosoft Access Driver (*.mdb)};Dbq=c: \\mydir\\myfile .mdb;Uid=Admin; Pwd=
;") cur = conn.cursor()
cur.execute('se lect 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={Microso ft Access Driver
(*.mdb)};Dbq=c: \somepath\mydb. mdb;Uid=the_use r;Pwd=the_passw ord

JYV

"Jani Yusef" <ja**@persian.c om> a écrit dans le message de
news:d3******** *************** ***@posting.goo gle.com...
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.c om> a écrit dans le message de
news:d3******** *************** ***@posting.goo gle.com...
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
3534
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 call last): File "dbmod.py", line 2, in ? File "odbc.pyo", line 9, in ?
0
633
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 key with wreg.OpenKey. You must only open only a key with with this command i've you want to read the key, i've you want to write to the key always use wreg.CreateKey.
7
1881
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 am basicly using a dictionary to update a access database using an odbc connector. I am able to connect and it seems that I am able to loop through the code to update all the rows I need to. The one weird bug I seem to get is what ever is the...
3
1829
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 column number 3 (Expr1002)', 3326)
13
4930
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
3273
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 (I've been following ch. 13 of Mark Hammond's py on win32 book). But now I'm trying to do equivalent stuff on linux (Fedora Core 3) with python 2.3.5 and mysql. I'd like to stick with packages that are native to python, rather than relying on...
10
4361
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 thru one install and config, with a lot of handholding from IBM Support. I'm comfortable in unix but have never dealt with DB2 Connect there. (my main job is as an Oracle DBA, and most of my db's are on Solaris or AIX) I've found the install...
5
1879
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 natively with Python if it works (don't care about performance in this particular use case; just that it works). The only issue I've had so far is retrieving data from Oracle when an
2
1853
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 dictionary that I've uploaded from elsewhere. These scripts have run hundreds of times in the last few weeks with no problems. But recently they continue to bail on the mycursor.execute('An SQL Statement') after the table has been created. I get the...
3
4932
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 "D:/softwares/Apache2.2/htdocs"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory>
0
7977
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7894
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8276
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8044
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8261
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3936
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1496
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.