[Zope-DB] Problems with ZODBC & User type

Samir Mishra SamirMishra@cbuae.gov.ae
Wed, 9 Jul 2003 11:50:57 +0400


I sent my last response directly to Marc (sorry about that) whereas I was
planning to send it to the mailing list.

Marc, thanks, I'll see what I can do here. I was hoping this was behaviour
someone else had come across before me. And had a solution.

Samir.

-----Original Message-----
From: M.-A. Lemburg [mailto:mal@lemburg.com]
Sent: Wednesday, July 09, 2003 11:40
To: Samir Mishra
Subject: Re: [Zope-DB] Problems with ZODBC & User type


Samir Mishra wrote:
> But why does the same query work for a user from the Manager group and not
> for normal users? I'm assuming all the scripts have the appropriate
security
> because the break is at the ODBC connection level. Which would tend to
make
> be believe this is more of a security related issue/bug.

In the end this could indeed be a permission problem which cannot
be reported back due to lack of buffer space or simply, that you
get different set of results when connected as user, some of which
trigger a truncation, e.g. due to implicit Unicode conversions.

mxODBC Zope DA allows you to ignore the warning message that
you see below by setting a connection option. That at least allows
you to track down the problem.

> Thanks.
> 
> -----Original Message-----
> From: M.-A. Lemburg [mailto:mal@lemburg.com]
> Sent: Monday, July 07, 2003 15:00
> To: Samir Mishra
> Cc: 'zope-db@zope.org'
> Subject: Re: [Zope-DB] Problems with ZODBC & User type
> 
> 
> Samir Mishra wrote:
> 
>>Hello all,
>>
>>I'm trying to run a query that updates a record in a table in MS SQL using
>>ZODBC. When I run the query as a manager, it runs without a hitch, but
> 
> when
> 
>>I try and run it as an authenticated user, I get the following error -
> 
> 
> You should try the same using the mxODBC Zope DA. ZODBC sends
> all data as strings and this can easily cause a data truncation
> to happen.
> 
> The mxODBC Zope DA interfaces to the ODBC driver using native data
> types whenever possible -- that's not only faster, it also avoids
> truncations due to SQL limits.
> 
> 
>>-----------------
>>Site Error
>>An error was encountered while publishing this resource. 
>>
>>sql.error
>>
>>Sorry, a site error occurred.
>>
>>Traceback (innermost last): 
>>
>>Module ZPublisher.Publish, line 150, in publish_module 
>>Module Products.Localizer, line 57, in new_publish 
>>Module ZPublisher.Publish, line 114, in publish 
>>Module Zope.App.startup, line 182, in zpublisher_exception_hook 
>>Module ZPublisher.Publish, line 98, in publish 
>>Module ZPublisher.mapply, line 88, in mapply 
>>Module ZPublisher.Publish, line 39, in call_object 
>>Module OFS.DTMLMethod, line 126, in __call__ 
>>Module DocumentTemplate.DT_String, line 474, in __call__ 
>>Module DocumentTemplate.DT_Util, line 201, in eval
>>__traceback_info__: REQUEST 
>>Module <string>, line 2, in f 
>>Module Shared.DC.ZRDB.DA, line 428, in __call__ 
>>Module Products.ZODBCDA.db, line 198, in query 
>>
>>sql.error: ('22001', 8152, '[Microsoft][ODBC SQL Server Driver][SQL
>>Server]String or binary data would be truncated.') (Also, an error
> 
> occurred
> 
>>while attempting to render the standard error message.) 
>>
>>----------------
>>
>>Could someone help me with this? Not sure where the problem is, and it
>>definitely works when I'm logged in as a manager.
>>
>>TIA.
>>
>>Regards,
>>Samir
>>
>>_______________________________________________
>>Zope-DB mailing list
>>Zope-DB@zope.org
>>http://mail.zope.org/mailman/listinfo/zope-db
> 
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Jul 09 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2003-07-01: Released mxODBC.Zope.DA for FreeBSD             1.0.6 beta 1