[egenix-users] Catching informational messages in mxODBC and
mal at egenix.com
Tue Oct 19 22:03:16 CEST 2004
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 by
> a long way. I read "2.7.1 Database Warnings" saying you can catch warnings by
> 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 know
> 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.
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