[egenix-users] Catching informational messages in mxODBC and
Martin J. Evans
martin.evans at easysoft.com
Wed Oct 20 10:01:14 CEST 2004
Forgive me for asking but do you know about how long I'll have to wait for
If you can't answer that (which would not surprise me) do you have an idea of
how complicated it would be to port errorhandler from mxODBC Zope DA to
Martin J. Evans
Easysoft Ltd, UK
On 19-Oct-2004 M.-A. Lemburg wrote:
> Martin J. Evans wrote:
>> I have some python which uses mxODBC to insert into a database. The insert
>> causes an ODBC SQL_SUCCESS_WITH_INFO return in execute() and outputs the
>> diagnostic to the terminal. I don't want to see this. I am no Python expert
>> a long way. I read "2.7.1 Database Warnings" saying you can catch warnings
>> setting an error handler but I don't know how to tie the error handler to my
>> connection e.g.
>> import mx.ODBC.unixODBC as mx
>> db = mx.DriverConnect('DSN=test;UID=user;PWD=password;')
>> db.errorhandler = None # want to insert the name of my handler here
>> # as per 2.7.1 example
>> c = db.cursor()
>> c.execute('use test')
>> fails with "TypeError: attribute 'errorhandler' unknown or read-only". I
>> the example above is not an insert but the "use test" to MS SQL Server
>> causes an informational.
> The .errorhandler feature is part of mxODBC 2.1 which is
> the basis for the mxODBC Zope DA. It is not available in the
> standalone version of mxODBC which is still at 2.0.
>> I saw mxODBC can be compiled to stop the display of informationals but
>> that is not an option for me.
>> I am using mxODBC 2.0.1 if that makes a difference.
>> Any ideas?
> I guess you will have to wait for mxODBC 2.1.
> Marc-Andre Lemburg
> Professional Python Services directly from the Source (#1, Oct 19 2004)
> >>> Python/Zope Consulting and Support ... http://www.egenix.com/
> >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
>::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the egenix-users