By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,932 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,932 IT Pros & Developers. It's quick & easy.

db access

P: n/a
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

Dec 28 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
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
Dec 28 '06 #2

P: n/a

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:
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
Dec 28 '06 #3

P: n/a
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
Dec 28 '06 #4

P: n/a
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

Dec 28 '06 #5

P: n/a
On 12/28/06, Martin P. Hellwig <mh******@xs4all.nlwrote:
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.
Dec 28 '06 #6

P: n/a
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
Dec 28 '06 #7

P: n/a

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:
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
Dec 29 '06 #8

P: n/a

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

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

Dec 29 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.