db access

K

king kikapu

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
 
M

Martin P. Hellwig

king said:
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,
 
K

king kikapu

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 ??
 
M

Martin P. Hellwig

king said:
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?
 
L

Laszlo Nagy

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
 
C

Chris Mellon

<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.
 
J

johnf

king said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top