Re: mx.ODBC error: Invalid Descriptor Index

Alexandre Fayolle <alexandre.fayolle-yG1kfhx/[email protected]>
Newsgroups gmane.comp.python.egenix.user
Organization Logilab
Message-ID <[email protected]>
Hello Charlie, 

Thanks for you answer. 

On Thursday 15 April 2010 17:30:06 Charlie Clark wrote:
> Am 15.04.2010, 17:14 Uhr, schrieb Alexandre Fayolle> 


> This looks like an incorrect application of the parameters. You *use* ?
> for parameters in this case. You must use string formatting to generate
> your SQL statement for "SELECT ?, ? FROM table" from your first example
> because you are passing variables to a statement and not parameters to the
> database which has already prepared the statement. 

Let me rephrase this. I was lazy, the call generating the exception was:

datetime1= datetime.datetime(2010, 4, 15, 16, 51, 25, 468000)
datetime2 = datetime.datetime(2010, 4, 15, 16, 51, 25, 453000)
cursor.executedirect('UPDATE cw_CWUser SET cw_modification_date = ?,
cw_last_login_time = ? WHERE cw_eid = ?', (datetime1, datetime2, 5))

The exception is  mx.ODBC.Error.DataError: ('22008', 0, '[Microsoft][SQL 
Server Native Client 10.0]Datetime field overflow. Fractional second precision 
exceeds the scale specified in the parameter binding.', 7748)

> The ODBC trace log is produced by the ODBC driver not by mxODBC.

I was thinking of the mxODBC.log file mentionned in §4.7 of the mxODBC 
documentation. Is it possible to enable ODBC driver tracing when you don't go 
through the ODBC Data Source manager to connect to the database? 

-- 
Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, CubicWeb, Debian :  http://www.logilab.fr/formations
Développement logiciel sur mesure :      http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science


_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
https://www.egenix.com/mailman/listinfo/egenix-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.