looking for ocbc example

supercooper supercooper at gmail.com
Thu Nov 29 17:24:52 CET 2007


On Nov 28, 2:43 am, Tim Golden <m... at timgolden.me.uk> wrote:
> Carl K wrote:
> > jay graves wrote:
> >> On Sep 21, 2:43 am, Tim Golden <m... at timgolden.me.uk> wrote:
> >>> Carl K wrote:
> >>>> It seems there are 2 odbc modules - pyOdbc and mxOdbc - anyone know the difference?
> >>> In short, pyodbc is open source; mxOdbc requires a commercial license.
> >>> pyodbc is a newcomer, but appears to work for everything I've thrown
> >>> at it (which is not much). mxOdbc has been around longer, and is sure
> >>> to be a more mature product. It may offer more features & functionality.
> >> There is also a brand new module 'ceODBC'.
> >>http://ceodbc.sourceforge.net/
>
> >> I haven't used it yet but I want to give it a try.
>
> > I tried it, and it worked better than pyodbc.  (better is not exactly right.
> > there was some weird bug in the ctree odbc driver, and the author of ceODBC gave
> > me a workaround.)
>
> All right, I'm a little perplexed as to whether "better" here
> refers to the admirable response of the ceOBDC author or to
> some other factors which demonstrate ceODBC's superiority.
>
> I've not really got the opportunity to pit them against each
> other so to speak, but I'd love to hear from someone who had.
>
> TJ

Just tried ceODBC the other day (on XP), and it worked like a charm
connecting SqlServer and DB2. Here's SqlServer:

>>> import ceODBC
>>> db=ceODBC.connect('DSN=Wells')
>>> c=db.cursor()
>>> c.execute('select wellname, latitudedecimal, longitudedecimal from dbo.wells where wellid in (11587,11194,11157)')
>>> for each in c.fetchall():
...     print each
...
('GILL #1-18', 33.095599, -92.38563)
('HOW #2-7', 35.10155, -91.48824)
('JKK #11-13', 34.09130, -93.45256)

Simple! Very similar syntax to mxODBC.



More information about the Python-list mailing list