configuring ODBC DSN with a python script

Discussion in 'Python' started by Jani Yusef, Feb 4, 2004.

  1. Jani Yusef

    Jani Yusef Guest

    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!!
     
    Jani Yusef, Feb 4, 2004
    #1
    1. Advertising

  2. Jani Yusef

    Jarek Zgoda Guest

    Jani Yusef <> 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/
     
    Jarek Zgoda, Feb 4, 2004
    #2
    1. Advertising

  3. On 4 Feb 2004 11:09:52 -0800, (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
     
    Andy Robinson, Feb 5, 2004
    #3
  4. 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" <> a écrit dans le message de
    news:...
    > 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!!
     
    Jean-Yves Vinet, Feb 5, 2004
    #4
  5. He is a good site about that

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

    JYV

    "Jani Yusef" <> a écrit dans le message de
    news:...
    > 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!!
     
    Jean-Yves Vinet, Feb 5, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Brewer
    Replies:
    1
    Views:
    633
    omission9
    Feb 5, 2004
  2. Robert Brewer
    Replies:
    1
    Views:
    397
    omission9
    Feb 6, 2004
  3. Robert Brewer
    Replies:
    0
    Views:
    367
    Robert Brewer
    Feb 6, 2004
  4. test test
    Replies:
    0
    Views:
    349
    test test
    Apr 2, 2004
  5. Arpan

    System DSN Faster Than File DSN!

    Arpan, Jun 26, 2005, in forum: ASP General
    Replies:
    7
    Views:
    285
Loading...

Share This Page