db access

Discussion in 'Python' started by king kikapu, Dec 28, 2006.

  1. king kikapu

    king kikapu Guest

    Hi to all,

    is there a way to use an RDBMS (in my case, SQL Server) from Python by
    using some built-in module of the language (v. 2.5) and through ODBC ??
    I saw some samples that use statements like "import dbi" or "import
    odbc" but neither modules (dbi, odbc) are present on my system...

    Any hint(s) ??

    Thanks in advance
     
    king kikapu, Dec 28, 2006
    #1
    1. Advertising

  2. king kikapu wrote:
    > Hi to all,
    >
    > is there a way to use an RDBMS (in my case, SQL Server) from Python by
    > using some built-in module of the language (v. 2.5) and through ODBC ??
    > I saw some samples that use statements like "import dbi" or "import
    > odbc" but neither modules (dbi, odbc) are present on my system...
    >
    > Any hint(s) ??
    >
    > Thanks in advance
    >

    Hey there,

    Take a look at this:
    http://www.python.org/doc/topics/database/

    Cheers,

    --
    mph
     
    Martin P. Hellwig, Dec 28, 2006
    #2
    1. Advertising

  3. king kikapu

    king kikapu Guest

    Hey Martin,

    thanks for the fast reply!

    I have already seen that link and i just downloaded the pyodbc module
    but isn't Python already containing a "built-in" odbc module so to
    allow for db communication ??

    On Dec 28, 6:06 pm, "Martin P. Hellwig" <> wrote:
    > king kikapu wrote:
    > > Hi to all,

    >
    > > is there a way to use an RDBMS (in my case, SQL Server) from Python by
    > > using some built-in module of the language (v. 2.5) and through ODBC ??
    > > I saw some samples that use statements like "import dbi" or "import
    > > odbc" but neither modules (dbi, odbc) are present on my system...

    >
    > > Any hint(s) ??

    >
    > > Thanks in advanceHey there,

    >
    > Take a look at this:http://www.python.org/doc/topics/database/
    >
    > Cheers,
    >
    > --
    > mph
     
    king kikapu, Dec 28, 2006
    #3
  4. king kikapu wrote:
    > Hey Martin,
    >
    > thanks for the fast reply!
    >
    > I have already seen that link and i just downloaded the pyodbc module
    > but isn't Python already containing a "built-in" odbc module so to
    > allow for db communication ??
    >

    <cut>
    Not that I'm aware of, but it is possible to do odbc with the win32
    extensions which are commonly installed on windows machines, perhaps
    you've seen something like that?

    --
    mph
     
    Martin P. Hellwig, Dec 28, 2006
    #4
  5. king kikapu

    Laszlo Nagy Guest

    king kikapu írta:
    > Hey Martin,
    >
    > thanks for the fast reply!
    >
    > I have already seen that link and i just downloaded the pyodbc module
    > but isn't Python already containing a "built-in" odbc module so to
    > allow for db communication ??
    >

    There is no built-in ODBC module. We all know that Python comes with
    batteries included. :) So if you only want to play with SQL then you
    can use the SQLite package. That is built in Python 2.5. But if you wish
    to connect to MS SQL, you need to install a third party package. Python
    does not come with submarine battery packs included, only simple
    batteries. The good news is that it costs nothing to install additional
    extensions.

    By the way, if you plan to use MS SQL from Python, I would recommend ADO
    instead. ODBC is very old technology. ADO is much better supported. ADO
    can be accessed from Activestate Python (which is a special Python
    version from the win32 platform). The other alternative is to install
    the win32 extensions for Python. (And probably there are other
    alternatives as well.)

    I recommend this:

    http://www.mayukhbose.com/python/ado/index.php

    Best,

    Laszlo
     
    Laszlo Nagy, Dec 28, 2006
    #5
  6. king kikapu

    Chris Mellon Guest

    On 12/28/06, Martin P. Hellwig <> wrote:
    > king kikapu wrote:
    > > Hey Martin,
    > >
    > > thanks for the fast reply!
    > >
    > > I have already seen that link and i just downloaded the pyodbc module
    > > but isn't Python already containing a "built-in" odbc module so to
    > > allow for db communication ??
    > >

    > <cut>
    > Not that I'm aware of, but it is possible to do odbc with the win32
    > extensions which are commonly installed on windows machines, perhaps
    > you've seen something like that?
    >


    Yes, but you don't want to. Use pyodbc (or adodbapi, if you're windows
    only) and save yourself the trouble.
     
    Chris Mellon, Dec 28, 2006
    #6
  7. king kikapu

    johnf Guest

    king kikapu wrote:

    > Hi to all,
    >
    > is there a way to use an RDBMS (in my case, SQL Server) from Python by
    > using some built-in module of the language (v. 2.5) and through ODBC ??
    > I saw some samples that use statements like "import dbi" or "import
    > odbc" but neither modules (dbi, odbc) are present on my system...
    >
    > Any hint(s) ??
    >
    > Thanks in advance

    Although others have suggested using ODBC or ADO I have a different
    solution. If you wanted a multi-platform I would use FreeTDS with
    psmssql.py. psmssql.py does support the DB API 2.0 although it does not
    support any of the extendsions. Works with Linux, Mac and Windows.

    Johnf
     
    johnf, Dec 28, 2006
    #7
  8. king kikapu

    king kikapu Guest

    Hi Johnf,

    are you referring to this ?
    http://www.freetds.org/

    And how i can get psmssql.py so i can get a shot on it, is it included
    in FreeTDS ??



    On Dec 29, 12:12 am, johnf <> wrote:
    > king kikapu wrote:
    > > Hi to all,

    >
    > > is there a way to use an RDBMS (in my case, SQL Server) from Python by
    > > using some built-in module of the language (v. 2.5) and through ODBC ??
    > > I saw some samples that use statements like "import dbi" or "import
    > > odbc" but neither modules (dbi, odbc) are present on my system...

    >
    > > Any hint(s) ??

    >
    > > Thanks in advanceAlthough others have suggested using ODBC or ADO I have a different

    > solution. If you wanted a multi-platform I would use FreeTDS with
    > psmssql.py. psmssql.py does support the DB API 2.0 although it does not
    > support any of the extendsions. Works with Linux, Mac and Windows.
    >
    > Johnf
     
    king kikapu, Dec 29, 2006
    #8
  9. king kikapu

    vasudevram Guest

    king kikapu wrote:
    > On Dec 29, 12:12 am, johnf <> wrote:
    > > king kikapu wrote:
    > > > Hi to all,

    > >
    > > > is there a way to use an RDBMS (in my case, SQL Server) from Python by
    > > > using some built-in module of the language (v. 2.5) and through ODBC ??
    > > > I saw some samples that use statements like "import dbi" or "import
    > > > odbc" but neither modules (dbi, odbc) are present on my system...

    > >
    > > > Any hint(s) ??

    > >


    Its not really related to your question, but if you also want to
    publish your database data to PDF, here's one way:

    http://mail.python.org/pipermail/python-list/2006-July/392099.html

    Vasudev
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Vasudev Ram
    Dancing Bison Enterprises
    Software training and consulting
    http://www.dancingbison.com
    http://www.dancingbison.com/products.html
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    vasudevram, Dec 29, 2006
    #9
    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. luican
    Replies:
    3
    Views:
    12,390
    Aaron W. West
    Jun 4, 2004
  2. david
    Replies:
    2
    Views:
    1,655
    Ken Cox [Microsoft MVP]
    Nov 24, 2003
  3. Guest
    Replies:
    2
    Views:
    577
    Guest
    Feb 2, 2004
  4. Guest
    Replies:
    0
    Views:
    524
    Guest
    Feb 9, 2004
  5. MSDN
    Replies:
    0
    Views:
    692
Loading...

Share This Page