Subject Re: [firebird-support] Re: odbc firebird-access: The decimal field's precision is too small to accept ...
Author Helen Borrie
At 02:25 AM 13/10/2009, you wrote:

>My problem isn't at the code(VB) level (perhaps it is a consequence!) but on odbc/table level..

Actually, it is occurring at column level. DECIMAL is an SQL data type for numbers. Access doesn't support all of the SQL number types and, from my distant recollection, it doesn't support the fixed numeric types DECIMAL and NUMERIC. DECIMAL (and NUMERIC) columns are defined with both a precision and a scale, so drivers have to compensate for that and try to convert between them.

The Access side is expecting decimal number of a certain precision (total number of digits) and scale (count of digits after the decimal point) based on what the *Access* ODBC driver tells it to expect. Your error message (which is probably coming from the Access driver) is telling you that it is (unsuccessfully) trying to convert the number from this column into an Access number, because the number is too large to fit into the precision that has been defined for it in the Access table.

>With your explanation I think the problems occur, as you said, in odbc level.

That is what I was referring to as "the interface layer" which, as a minimum, would consist of the Access ODBC driver, the Firebird ODBC driver and the firebird client library. To get the inside story on that, arm yourself with the metadata info about the column definitions on both ends and raise as useful a question as possible in the firebird-odbc-devel list. You can find the link for subscribing to that list at http://firebirdsql.org/index.php?op=lists

>In fact already when I attempt to open linked tables in access I find this problem in few records (a lot of others, instead, are correct).. Only for open a table, without query or vb code, but only with doble click.

In any application, it is necessary to cater for the largest possible size of data that the database column can (potentially) store and deliver, which takes you back to the metadata definitions. You mentioned that you are a programmer; but perhaps you are new to SQL databases and haven't yet discovered that SQL data types are not the same as VB data types; nor, indeed, are they the same as the data types in any programming language. The VB/Access combination can cleverly hide this from the unsuspecting VB programmer!

>You suggest also to cast data... So I ask you: how I can cast data if I can't work on casting? In fact the schema of a linked table in access can't be changed; ad so for firebird tables because the firebird db is of a third part comapany..

Casting can be done in your SELECT statements, using the CAST() sql function. There are some pretty restrictive rules that will affect you if you remain unaware of the capabilities and limitations of the data types in the two database implementations.

>For the data is the same thing: neither I' can't intercept exception nor i can't cast decimals that raise error.. In fact I can't interfer between firebird and access when table are linked and opened.. It is an autoamtic operation of access through odbc driver..

Drivers convey exceptions that are received from the database and interpret them for the host language. If you write a database application, it is a total necessity to catch the database exceptions and provide the user with a solution.

It also seems from the comment above that you have only the Access odbc driver in the picture. You need the Firebird odbc driver in the picture as well.

>My last hope is firebird-odbc-support.. I'll try to ask them if there is a solution.

Actually, this topic is ALL about your ODBC layer. Go there. The members there won't teach you how to write database applications but they have all used the Firebird ODBC driver and can help you with configuration of the data source.

If you feel you need a higher level of support than you can get from a peer list, you could consider using a commercial ODBC driver with support attached, e.g., www.easysoft.com.

./heLen