Mailing List Archive

Installing ODBC on PythonWin
Before I go wack and take it out on my computer
like this guy
(http://www.web42.com/badday/badday_small.mpg)
did, I'd like to ask for some help.

I'm trying to install an ODBC module into
PythonWin, but it still *won't* work!

It is written that the ODBC module is included in
the pythonwin distribution but >>>import ODBC
says otherwise. I've d/e'd (downloaded/executed)
Win32, but it died and said that it was looking
for version 1.4!

I was able to partially install mxODBC by copying
all the files into the right place but I'm having
trouble compiling the modules in vc++.

I'm going to pull my hair out!!! Could someone
show me an easier way of installing ODBC? (I
don't want to mess with DAO since I'm expecting
to migrate data from a database.)

Hhelp!!

SL


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Installing ODBC on PythonWin [ In reply to ]
Before I go wack and take it out on my computer
like this guy
(http://www.web42.com/badday/badday_small.mpg)
did, I'd like to ask for some help.

I'm trying to install an ODBC module into
PythonWin, but it still *won't* work!

It is written that the ODBC module is included in
the pythonwin distribution but >>>import ODBC
says otherwise. I've d/e'd (downloaded/executed)
Win32, but it died and said that it was looking
for version 1.4!

I was able to partially install mxODBC by copying
all the files into the right place but I'm having
trouble compiling the modules in vc++.

I'm going to pull my hair out!!! Could someone
show me an easier way of installing ODBC? (I
don't want to mess with DAO since I'm expecting
to migrate data from a database.)

Hhelp!!

SL


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Installing ODBC on PythonWin [ In reply to ]
Before I go wack and take it out on my computer
like this guy
(http://www.web42.com/badday/badday_small.mpg)
did, I'd like to ask for some help.

I'm trying to install an ODBC module into
PythonWin, but it still *won't* work!

It is written that the ODBC module is included in
the pythonwin distribution but >>>import ODBC
says otherwise. I've d/e'd (downloaded/executed)
Win32, but it died and said that it was looking
for version 1.4!

I was able to partially install mxODBC by copying
all the files into the right place but I'm having
trouble compiling the modules in vc++.

I'm going to pull my hair out!!! Could someone
show me an easier way of installing ODBC? (I
don't want to mess with DAO since I'm expecting
to migrate data from a database.)

Hhelp!!

SL


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Installing ODBC on PythonWin [ In reply to ]
Before I go wack and take it out on my computer like this guy
(http://www.web42.com/badday/badday_small.mpg) did, I'd like to ask for
some help.

I'm trying to install an ODBC module into PythonWin, but it still
*won't* work!

It is written that the ODBC module is included in the pythonwin
distribution but >>>import ODBC says otherwise. I've d/e'd
(downloaded/executed) Win32, but it died and said that it was looking
for version 1.4!

I was able to partially install mxODBC by copying all the files into
the right place but I'm having trouble compiling the modules in vc++.

I'm going to pull my hair out!!! Could someone show me an easier way of
installing ODBC? (I don't want to mess with DAO since I'm expecting to
migrate data from a database.)

Hhelp!!

SL


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Installing ODBC on PythonWin [ In reply to ]
After installing the Python interpreter, and the Win32 extensions.
(They're available at: http://www.python.org/download/download_windows.html)

Check out:
http://www.python.org/windows/OdbcHints.html

For hints on using ODBC with Python on Windows.

The answer to your question is that inorder to import the odbc module, you
need to import the dbi module first.
e.g.:
import dbi
import odbc

conn = odbc.odbc('DSNname')
cursor = conn.cursor()
cursor.execute('select * from EndUser')
....


Bill
Installing ODBC on PythonWin [ In reply to ]
bruises@my-deja.com wrote:
>
> Before I go wack and take it out on my computer
> like this guy
> (http://www.web42.com/badday/badday_small.mpg)
> did, I'd like to ask for some help.
>
> I'm trying to install an ODBC module into
> PythonWin, but it still *won't* work!
>
> It is written that the ODBC module is included in
> the pythonwin distribution but >>>import ODBC
> says otherwise. I've d/e'd (downloaded/executed)
> Win32, but it died and said that it was looking
> for version 1.4!
>
> I was able to partially install mxODBC by copying
> all the files into the right place but I'm having
> trouble compiling the modules in vc++.

There should be no need to compile the module: the
package comes with a precompiled version. All you have
to do is unzip the archive in e.g. \python\lib and
you're set. If you have the win32 libs installed, be
sure to rename the included odbc.pyd to win32odbc.pyd.

--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 199 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
Installing ODBC on PythonWin [ In reply to ]
eeghead84@yahoo.com wrote:

> It is written that the ODBC module is included in the pythonwin
> distribution but >>>import ODBC says otherwise. I've d/e'd
> (downloaded/executed) Win32, but it died and said that it was looking
> for version 1.4!

If you download the latest Python and Win32 from
http://www.python.org/download/download_windows.html it should be fine.
You'll want to write "import dbi, odbc" though.

Now for my problems.

I've got an Access database accessed by Python scripts under CGI. However,
sometimes, calls to odbc.odbc(dsn) hang up and never return. (Eventually the
web server times out and kills the process.) This seems to happen randomly,
but increasingly. Does anyone have any idea why? A fault with the odbc
module, or Access, or what?

--
This posting was brought to you by And Clover.
(Sorry.)
Installing ODBC on PythonWin [ In reply to ]
Andrew Clover has Access problems:

> I've got an Access database accessed by Python scripts under CGI.
> However,
> sometimes, calls to odbc.odbc(dsn) hang up and never return.
> (Eventually the web server times out and kills the process.) This
> seems to happen randomly, but increasingly. Does anyone have any
> idea why? A fault with the odbc module, or Access, or what?

Repeat after me: "Access is NOT a server, Access is NOT a server".

It is a file access method. If you access it through Jet (ie, DAO or
one of those) it is sort-of safe for multiuser usage. If accessed
through ODBC it is most definitely absolutely NOT safe. It's not even
safe for mutiple connections from one process.

Access is dandy on the desktop as an overgrown spreadsheet. It is the
LAST thing you should use for CGI.

- Gordon
Installing ODBC on PythonWin [ In reply to ]
(References lost due to having to post through a slow newsfeed whilst
reading replies in deja.com...)

Gordon McMillan <gmcm@hypernet.com> soothed my Access pain with:

> Repeat after me: "Access is NOT a server, Access is NOT a server".

Erm... Access is not a server. I guess. :-)

Access is barely competent as a client...

> If accessed through ODBC it is most definitely absolutely NOT safe. It's
> not even safe for mutiple connections from one process.

> Access is dandy on the desktop as an overgrown spreadsheet. It is the LAST
> thing you should use for CGI.

It would seem so. I knew we'd have to move to a non-cruddy dbms at some
point, but I had imagined Access would be able to cope with a single user
(viz me) clicking Reload on a CGI page repeatedly. I guess it was naive of
me to expect anything much of MS's flagship Office suite...

Oh well. I downloaded and installed MySQL and though the process wasn't
terribly pleasant, at least the damned thing *works* now. Anyone want to
criticise this choice of server/suggest something else?

ObPython - actually Ob<eeghead84@yahoo.com>'s-original posting:

> I was able to partially install mxODBC by copying all the files into the
> right place but I'm having trouble compiling the modules in vc++.

> I'm going to pull my hair out!!! Could someone show me an easier way of
> installing ODBC?

Hmm... earlier whilst trying to figure out what was going on, I DLed mxODBC
as a replacement for ODBC, and it worked relatively painlessly - the
distribution at http://starship.skyport.net/crew/lemburg/mxODBC-1.1.1.zip
included precompiled .pyds so there was no need to compile anything, though
it is necessary to include the ODBC directory (and DateTime) in PythonPath
somewhere.

wwww - wish I weren't working with Windows.

--
This posting was brought to you by And Clover.
(Sorry.)
Installing ODBC on PythonWin [ In reply to ]
In article <7ke9kq$3c2$1@holly.csv.warwick.ac.uk>,
esuzm@primrose.csv.warwick.ac.uk (Andrew Clover) wrote:
> eeghead84@yahoo.com wrote:
>
> > It is written that the ODBC module is included in the pythonwin
> > distribution but >>>import ODBC says otherwise. I've d/e'd
> > (downloaded/executed) Win32, but it died and said that it was
> > looking for version 1.4!
>
> If you download the latest Python and Win32 from
> http://www.python.org/download/download_windows.html it should be
> fine. You'll want to write "import dbi, odbc" though.
>
> Now for my problems.
>
> I've got an Access database accessed by Python scripts under CGI.
> However, sometimes, calls to odbc.odbc(dsn) hang up and never return.
> (Eventually the web server times out and kills the process.) This
> seems to happen randomly, but increasingly. Does anyone have any
> idea why? A fault with the odbc module, or Access, or what?

Oh, that is interesting. I had a similar problem with the driver
to a remote Navision database and was suspecting it was limited
to that configuration - I do not use ODBC very much.
Inserting a delay after the import seemed to "fix" my problem:

import dbi, odbc
import time
time.sleep (3)

odbc_nav = odbc.odbc (dsn_nav)

--
Uwe Zessin


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Installing ODBC on PythonWin [ In reply to ]
esuzm@primrose.csv.warwick.ac.uk (Andrew Clover) writes:

> Oh well. I downloaded and installed MySQL and though the process wasn't
> terribly pleasant, at least the damned thing *works* now. Anyone want to
> criticise this choice of server/suggest something else?

MySQL rocks. Although I've never used the ODBC layer or the windows
version of it though.

--
Alex Rice | alrice@swcp.com | http://www.swcp.com/~alrice
Current Location: N. Rio Grande Bioregion, Southwestern USA