Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 28th, 2006, 03:55 PM
king kikapu
Guest
 
Posts: n/a
Default db access

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

  #2  
Old December 28th, 2006, 04:15 PM
Martin P. Hellwig
Guest
 
Posts: n/a
Default Re: db access

king kikapu wrote:
Quote:
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
  #3  
Old December 28th, 2006, 04:15 PM
king kikapu
Guest
 
Posts: n/a
Default Re: db access


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" <mhell...@xs4all.nlwrote:
Quote:
king kikapu wrote:
Quote:
Hi to all,
>
Quote:
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...
>
Quote:
Any hint(s) ??
>
Quote:
Thanks in advanceHey there,
>
Take a look at this:http://www.python.org/doc/topics/database/
>
Cheers,
>
--
mph
  #4  
Old December 28th, 2006, 04:35 PM
Martin P. Hellwig
Guest
 
Posts: n/a
Default Re: db access

king kikapu wrote:
Quote:
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
  #5  
Old December 28th, 2006, 04:45 PM
Laszlo Nagy
Guest
 
Posts: n/a
Default Re: db access

king kikapu írta:
Quote:
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



  #6  
Old December 28th, 2006, 04:45 PM
Chris Mellon
Guest
 
Posts: n/a
Default Re: db access

On 12/28/06, Martin P. Hellwig <mhellwig@xs4all.nlwrote:
Quote:
king kikapu wrote:
Quote:
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.
  #7  
Old December 28th, 2006, 10:15 PM
johnf
Guest
 
Posts: n/a
Default Re: db access

king kikapu wrote:
Quote:
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


  #8  
Old December 29th, 2006, 09:45 AM
king kikapu
Guest
 
Posts: n/a
Default Re: db access


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 <jfabi...@yolo.comwrote:
Quote:
king kikapu wrote:
Quote:
Hi to all,
>
Quote:
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...
>
Quote:
Any hint(s) ??
>
Quote:
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
  #9  
Old December 29th, 2006, 06:35 PM
vasudevram
Guest
 
Posts: n/a
Default Re: db access


king kikapu wrote:
Quote:
On Dec 29, 12:12 am, johnf <jfabi...@yolo.comwrote:
Quote:
king kikapu wrote:
Quote:
Hi to all,
Quote:
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...
Quote:
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/pyt...ly/392099.html

Vasudev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vasudev Ram
Dancing Bison Enterprises
Software training and consulting
http://www.dancingbison.com
http://www.dancingbison.com/products.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles