Issue 87325 - Export/Import .dbf fails - integrated
Summary: Export/Import .dbf fails - integrated
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: save-export (show other issues)
Version: OOo 2.4 RC5
Hardware: All All
: P3 Trivial with 6 votes (vote)
Target Milestone: ---
Assignee: marc.neumann
QA Contact: issues@sc
URL: https://bugs.edge.launchpad.net/ubunt...
Keywords: regression
: 88061 88139 89094 (view as issue list)
Depends on:
Blocks: 87736 88258
  Show dependency tree
 
Reported: 2008-03-22 04:41 UTC by ccheney
Modified: 2013-08-07 15:15 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
original ods file exhibiting issue (6.36 KB, application/vnd.oasis.opendocument.spreadsheet)
2008-03-22 04:43 UTC, ccheney
no flags Details
resulting dbf file exported (129 bytes, application/octet-stream)
2008-03-22 04:43 UTC, ccheney
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description ccheney 2008-03-22 04:41:23 UTC
1) Open attached test-dbf.ods file.
2) Save as test-dbf.dbf.
3) DBase export: Select Unicode (UTF-8).
4) It displays this message

Error saving the document test-dbf:
Connection to the file could not be established.

5) close test-dbf.ods
6) open test-dbf.dbf
7) Import DBase files: Select Unicode (UTF-8)
8) Notice the three cells have changed from (10 : 10 : 10) to weird stuff
(N1,N,5,2 : N2,N,5,2 : N3,N,5,2)

I have attached both files.
Comment 1 ccheney 2008-03-22 04:43:06 UTC
Created attachment 52240 [details]
original ods file exhibiting issue
Comment 2 ccheney 2008-03-22 04:43:41 UTC
Created attachment 52241 [details]
resulting dbf file exported
Comment 3 drewjensen.inbox 2008-03-24 04:32:25 UTC
Tried this using 2.4 RC6 under Win XP - same problem.
Tried again using 2.3.1 under Win XP - no problem
Comment 4 mhatheoo 2008-03-25 18:32:48 UTC
well, UTF-8 should not be an option for DBase-Export/Import - that sounds
senseless to me

Martin
Comment 5 ccheney 2008-03-25 18:52:33 UTC
From what I recall I tried some of the other options as well and they didn't
work either. It wasn't just UTF-8, I just used that as example so I could exact
steps to reproduce the issue.
Comment 6 ccheney 2008-03-25 18:53:52 UTC
With respect to other comments, if it only works for a very limited subset of
language settings then it should be reduced to only allow those, so it is still
buggy regardless.
Comment 7 mhatheoo 2008-04-02 13:12:55 UTC
at cheney

I have a question, please:

Are dealing with 32-bit-character-codes (UTF) - also in other languages - or are
you striktly using 16-bit characters

This is, because DBASE-files should only work with 16-bit-CodePages, and i just
opened a wellformed DBF - exported it with "Save as ..." - and reopend it - and
all works fine (in here with CP 437)

please check

rgds
Martin
Comment 8 ccheney 2008-04-02 21:12:05 UTC
mhatheoo,

It doesn't work for me for any format I have selected so far (many of them not
just UTF-8). I am from the USA so we normally just use 8bit width characters and
don't even really have need for 16bit characters here. I only used the UTF-8
option in the walk-through to give a reproducible example. It always displays
weird 'N' stuff when I try to reopen it using the same format I saved out as. I
even selected the 'Western Europe (DOS/OS2-437/US)' which I think is the
codepage 437 you were referring to and it didn't work either. If some of the
very many options it lets you save in for DBF format aren't valid then those
should be removed, but so far I haven't found any of them to actually work at all.
Comment 9 petrvas 2008-04-03 04:40:52 UTC
I had the same problem on WinXP OpenOffice.org 2.4.0.
When I change 5 to 6 by hands in all handles of fields (N1, N2 and N3)
.dbf file was saved OK

Was 
N1,N,5,2
must by 
N1,N,6,2
and so on.

I think, if you will input negative value (-10), export will work OK :-)
Comment 10 ooo 2008-04-03 20:43:40 UTC
Folks, the "weird stuff" (N1,N,5,2) you see in the first row after having opened
a dBase file is the field structure. This is on purpose to make sure that when
saving the file the identical structure is used, since other applications may
depend on the exact structure. The sequence is fieldname,fieldtype,length,decimals.

Seeing only that and no data is the result of the error that occurred during
saving, apparently only the dBase header can be written and the database engine
after that dislikes to write the file. The assumptions about character sets are
not true.

It seems that writing 2 digit integers to fieldwidth 5 with 2 decimals for some
unknown reason is rejected by the database engine. Changing width to one more
than is needed works around.

@oj: Ocke, anything known about that?
Comment 11 ocke.janssen 2008-04-04 07:34:35 UTC
Hi,

when you try to save as dbf I noticed that a SQLException is thrown with this
statement
"The "N1" column has been defined as a "Decimal" type, the max. length is 3
characters (with 2 decimal places).

The specified value is longer than the number of digits allowed." 

So you have to have in mind that N,5,2 means that can the value can be 5
characters long. 2 characters are reserved for the decimal places and 1
character for the sign (+/-). In other words only values from (+,-)(0..9).(xx)
can be saved correctly.
Comment 12 ooo 2008-04-04 11:42:52 UTC
Ocke, this is broken. It worked for years up to OOo2.3.1 that automatic
determination of the field width does not have to take a hypothetical sign
character into account if there wasn't any. I also don't see why one would have
to waste an extra character for a sign if there are no signed values. The dBase
specification IMHO doesn't require it, and we wouldn't be able to save in the
identical structure once loaded if a file had numeric fields filled with
positive values up to the field width. Please fix.
Thanks
  Eike
Comment 13 ooo 2008-04-14 14:41:41 UTC
*** Issue 87972 has been marked as a duplicate of this issue. ***
Comment 14 ooo 2008-04-14 14:46:10 UTC
*** Issue 88061 has been marked as a duplicate of this issue. ***
Comment 15 ooo 2008-04-14 14:51:23 UTC
*** Issue 88139 has been marked as a duplicate of this issue. ***
Comment 16 wkclethero 2008-04-16 16:16:32 UTC
Same behaviour on windows xp; reverting to OO 2.3 fixes the problem. error
message was unable to access the file.
Comment 17 noop 2008-04-17 20:30:08 UTC
Just to add to this; from a standard Calc file - File|Save As|dBase (.dbf) also
does not work in linux OOo3.0devM7 (buildid=300m7(Build:9293)) and results in:

Error saving the document <document name>:
Connection to the file could not be established.

It does not seem to matter which character set is used.
Comment 18 kpalagin 2008-04-21 08:17:59 UTC
Happens on Windows too.
Comment 19 marc.neumann 2008-04-23 10:34:12 UTC
set target to 2.1.4
Comment 20 ocke.janssen 2008-04-23 12:19:31 UTC
Fixed in cws dba241b
Comment 21 ooo 2008-04-23 12:52:12 UTC
Thanks a lot!
Comment 22 ocke.janssen 2008-04-23 12:55:41 UTC
Please verify. Thanks.
Comment 23 noop 2008-04-25 03:38:07 UTC
Has this been fixed in 3.0 as well?
Comment 24 ocke.janssen 2008-04-25 08:57:30 UTC
Yes. It will be fixed for 3.0 as well.
Comment 25 marc.neumann 2008-04-25 09:37:22 UTC
verified in cws dba241b
Comment 26 marc.neumann 2008-04-25 12:08:11 UTC
set target to 3.0 to get this issue into 3.0 Beta. Then back to target 2.4.1 to
get it also into 2.4.1
Comment 27 uwe.luebbers 2008-04-28 11:57:22 UTC
added "approved" to the title, because it will be easier to work with the 2.4.1 meta issue 
during release status meetings.
Comment 28 uwe.luebbers 2008-04-29 16:47:47 UTC
added "integrated" to the title
Comment 29 dirk.voelzke 2008-05-07 15:56:53 UTC
*** Issue 89094 has been marked as a duplicate of this issue. ***
Comment 30 mhatheoo 2008-05-21 23:17:38 UTC
=>eike


I just read your comment regarding the point, that you think the coding of
characters is not important (post. 4.Apr.)
Thats not right. DBase can deal with fields of fixed length only - this is true
for text aswell as numbers, as numbers are not encoded in DBase but stored in
digits. By that, the possibility for save DBase with characters longer than one
byte should be disabled. Ofcorse that will be no problem in US, but in all other
countries will be - just as ccheney wrote on 2.Apr. 

btw: for the number-fields I thought, the leading figures (incl. a neg.sign in
case - no positiv), and the decimal-dot (if any) and the tailing decimals (if
any), all together will be given 15 characters space, filled from the right, the
"length"- parameter in not seriously used, it just must fit into that.

I am courious about 2.4.1

Martin 
Comment 31 sclays 2008-11-17 16:43:11 UTC
In scalc 3.0.0 this bug reappears!
Comment 32 smith77 2009-04-04 20:44:27 UTC
verifayed at master version OOo 3.1 - the error message dos not appear at the 
export but when opening the *.dbf file  that was exported the data is shown 
like in the exampele:
(N1,N,5,2 : N2,N,5,2 : N3,N,5,2)
windows vista
Comment 33 thorsten.ziehm 2009-07-20 14:55:54 UTC
This issue is closed automatically and wasn't rechecked in a current version of
OOo. The fixed issue should be integrated in OOo since more than half a year. If
you think this issue isn't fixed in a current version (OOo 3.1), please reopen
it and change the field 'Target Milestone' accordingly.

If you want to download a current version of OOo =>
http://download.openoffice.org/index.html
If you want to know more about the handling of fixed/verified issues =>
http://wiki.services.openoffice.org/wiki/Handle_fixed_verified_issues