ODBC Provider Error - Timestamp parameters with zero scale must have.......

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Brob
Posts: 44
Joined: Mon 24 Oct 2011 07:31

ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by Brob » Mon 04 Nov 2013 09:50

Hi

When using ODBC provider I get this error when trying to insert or update a value in a timestamp field.

"[DataDirect][ODBC Progress OpenEdge Driver]Timestamp parameters with zero scale must have a precision of 13, 16, or 19. Parameter number: 1, precision: 0."

I can use an ODBC parameter "WorkArounds2=2" to stop this but WorkArounds2 partameter is needed to for another problem using a different value and also I don't want my customer to have to put this on every computer.

Is there any way I stop this error? Maybe using Data Type Mapping Rules?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by AlexP » Mon 04 Nov 2013 13:38

Hello,

Please open access to server again, in order for us to try to reproduce the problem.

Brob
Posts: 44
Joined: Mon 24 Oct 2011 07:31

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by Brob » Mon 04 Nov 2013 14:25

Hello Alex
Connection details sent to your email

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by AlexP » Tue 05 Nov 2013 09:40

Hello,

There is no DATE_ADDED field in the PUB.ORT_REPORTS table, there is a DATE_CREATED field only, and I get a 'permission denied' error when attempting to modify it. Please clarify the table and the field, and check the access privileges.

Brob
Posts: 44
Joined: Mon 24 Oct 2011 07:31

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by Brob » Tue 05 Nov 2013 10:00

Sorry Alex
Forgot to grant you insert, update, delete on this table.
As you say the field is DATE_CREATED.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by AlexP » Wed 06 Nov 2013 08:57

hello,

Thank you for the information - we have reproduced the described situation. This behaviour is due to the specificity of the ODBC driver. In the MSDN documentation http://msdn.microsoft.com/en-us/library ... s.85).aspx it is claimed that the ColumnSize parameter and DecimalDigits are ignored in the SQLBindParameter method for SQL_TIMESTAMP types. However, the driver you are using (in contrast to the documentation) requires setting the ColumnSize parameter for this type. To solve the problem, you can either use the WorkArounds2=2 ODBC parameter or, if you have an edition with source code, we can tell the required modifications for setting a value for this parameter.

Brob
Posts: 44
Joined: Mon 24 Oct 2011 07:31

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by Brob » Wed 06 Nov 2013 09:34

Many thanks for investigating this problem for me.
I am upgrading to UniDAC edition with source code so if you could please send me the details of where to change the code that would be great.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by AlexP » Wed 06 Nov 2013 10:06

Hello,

To solve the problem, you should modify the TODBCCommand.DetectDataType method in the ODBCClassesUni.pas module as follows:

replace

Code: Select all

    SQL_TYPE_TIMESTAMP, SQL_TIMESTAMP: 
      DataType := dtDateTime;
with

Code: Select all

    SQL_TYPE_TIMESTAMP, SQL_TIMESTAMP: begin
      DataType := dtDateTime;
      Length := SQLLength;
    end;

Brob
Posts: 44
Joined: Mon 24 Oct 2011 07:31

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by Brob » Wed 06 Nov 2013 10:09

As always you came up a solution.
Thanks again.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by AlexP » Fri 08 Nov 2013 13:17

Hello,

If you have any other questions, feel free to contact us

Brob
Posts: 44
Joined: Mon 24 Oct 2011 07:31

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by Brob » Tue 11 Feb 2014 12:29

Hi Alex

Is there any possibility that a specific option could be added in the future for the connection or dataset objects to the deal with this problem?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODBC Provider Error - Timestamp parameters with zero scale must have.......

Post by AlexP » Wed 12 Feb 2014 14:36

As I wrote earlier, this problem is due to the driver you are using and it doesn't occur in any other ODBC driver. Unfortunately, we cannot add separate options for each specific driver, specification of which differs from the MSDN specification. Therefore you should either use the recommendations of your driver developer: use the WorkArounds2=2 ODBC parameter, or edit our code.

Post Reply