Invalid Precision Value when using parameters

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Invalid Precision Value when using parameters

Post by arusoft » Thu 13 Feb 2014 23:10

We are using ODBC connection for SQL Server. We have simple code with sql that has parameter , For example

uniQUERY.sql.text := 'select * from Table where Filed1 = :FieldValue';
uniQUERY.params[0].value := CheckListBox1.items[CheckListBox1.itemindex];
uniQUERY.active := true;

When I tried to set active := true, we are getting Invalid Precision error
[Microsoft][ODBC SQL Server Driver]Invalid Precision value.

The problem is that we cannot reproduce this locally. Its only happening on clients enviornment. SQL Server is 2008.

We are using uniDAC 4.6.11.

Pleas advice.

Thank You.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Mon 17 Feb 2014 11:31

Hello,

To solve the problem, try to specify explicitly the type and size of the parameter before assigning a value to it.

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Mon 17 Feb 2014 15:55

Thanks for reply Alex. But the questions is why can't we reproduce this locally. Why is this happening only for client. Is there some database setting that controls this.

Also for the same client when we try to log to SQL server through ODBC its forcing to do direct connect by showing the direct connect login window even though we are not calling. But again this is not the case at our end.

Thank You.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Tue 18 Feb 2014 09:22

Most probably, both problems are due to the used ODBC driver. The first one is due to the BindParam ODBC method, the second problem can't be reproduced. Please make sure that the same ODBC driver version is used on your and client computers.

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Tue 18 Feb 2014 22:15

ALex I asked the client exactly the same question and waiting for answer. Is there any know issues or recommendations from your side on ODBC driver version?

Thanks.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Wed 19 Feb 2014 08:53

To have access to the server, you should use not an ODBC driver, but the Native Client (or OLEDB) with the provider for SQL Server ( SQLServerUniProvider ). If you are using an ODBC provider, then this provider must be compatible with the used server version.

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Wed 19 Feb 2014 14:16

We are just using tUniConnection.

If a user uses sql server authentican then
UniConnection1.ProviderName := 'SQL Server';
UniConnection1.Server := SQLServerName;
UniConnection1.database := SQLServerDatabaseName;
UniConnection1.Username := SQLServerUsername;
UniConnection1.Password := SQLServerPassword;

But if a user chose ODBC then we use this
UniConnection1.SpecificOptions.Clear;
UniConnection1.SpecificOptions.Add('Authentication=auWindows');
UniConnection1.Connected := true;

Please let me know if you would recommend otherwise.


Thank You.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Fri 21 Feb 2014 11:51

When using ODBCUniprovider, specific settings for each database are unavailable (there is no Authentication option). Such settings must be set on creation of DSN in ODBC Data Source Administrator. We recommend to use SQLServerUniProvider for work with SQL Server, since it allows to configure connection parameters and DataSet more flexibly, as well as to use various SQL Server clients and requires no additional settings of DSN.

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Mon 24 Feb 2014 20:59

So we got reply from client with screen shots and we are seeing that they have same ODBC driver version at there end.

Please suggest what else we can do to fix this issue. Thank You.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Wed 26 Feb 2014 11:55

The problems may be due to different settings of the client and server, please check these settings as well.

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Wed 26 Feb 2014 14:15

Alex, can you please give a little bit more info on setting on Client & Server.

Thank You.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Fri 28 Feb 2014 11:49

Unfortunately, since we couldn't reproduce the problem on our side, we cannot tell what exact settings can cause the problem

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Mon 03 Mar 2014 02:17

We cannot use SQLServerUniProvider as we already have lot of code written which expects TuniConnection.

But my question is why is uniConnection calling direct connect dialog. Do you know what all reasons would uniConnection called direct connection all by itself.

Thanks.

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

Re: Invalid Precision Value when using parameters

Post by AlexP » Wed 05 Mar 2014 08:48

Please clarify, what you mean by "uniConnection calling direct connect dialog" ?

arusoft
Posts: 45
Joined: Thu 06 Sep 2012 20:19

Re: Invalid Precision Value when using parameters

Post by arusoft » Wed 05 Mar 2014 14:40

Its the same login window that appears for Oracle when we set Direct=True as below UniConnection1.SpecificOptions.Add('Oracle.Direct=True');

Thank You.

Post Reply