Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > db access

Reply
Thread Tools

db access

 
 
king kikapu
Guest
Posts: n/a
 
      12-28-2006
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

 
Reply With Quote
 
 
 
 
Martin P. Hellwig
Guest
Posts: n/a
 
      12-28-2006
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
 
Reply With Quote
 
 
 
 
king kikapu
Guest
Posts: n/a
 
      12-28-2006

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" <(E-Mail Removed)> 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


 
Reply With Quote
 
Martin P. Hellwig
Guest
Posts: n/a
 
      12-28-2006
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
 
Reply With Quote
 
Laszlo Nagy
Guest
Posts: n/a
 
      12-28-2006
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



 
Reply With Quote
 
Chris Mellon
Guest
Posts: n/a
 
      12-28-2006
On 12/28/06, Martin P. Hellwig <(E-Mail Removed)> 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.
 
Reply With Quote
 
johnf
Guest
Posts: n/a
 
      12-28-2006
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


 
Reply With Quote
 
king kikapu
Guest
Posts: n/a
 
      12-29-2006

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 <(E-Mail Removed)> 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


 
Reply With Quote
 
vasudevram
Guest
Posts: n/a
 
      12-29-2006

king kikapu wrote:
> On Dec 29, 12:12 am, johnf <(E-Mail Removed)> 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/pyt...ly/392099.html

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

 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very annoying error: Access to the path is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity Jay ASP .Net 2 08-20-2007 07:38 PM
403 Forbidden: You were denied access because: Access denied by access control list Southern Kiwi NZ Computing 6 03-19-2006 05:19 AM
one computer can access shared files the other can't even access =?Utf-8?B?SiBIYW1lcg==?= Wireless Networking 4 12-07-2004 03:13 AM
Desktop can't access Laptop but Laptop can access desktop =?Utf-8?B?Qmx1Y2FkZHk3MQ==?= Wireless Networking 2 11-23-2004 01:52 AM
How do I let people access the internet via an access point but not allow them access to my network yar Wireless Networking 4 09-21-2004 03:48 AM



Advertisments