Bug 157561 - Invalid error message opening .mdb/.accdb file
Summary: Invalid error message opening .mdb/.accdb file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.6.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: inReleaseNotes:24.8
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-02 13:07 UTC by garth.hutchinson
Modified: 2024-07-16 08:06 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Zip file containing .mdf and .accdb files (390.35 KB, application/x-zip-compressed)
2023-10-11 14:27 UTC, garth.hutchinson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description garth.hutchinson 2023-10-02 13:07:35 UTC
Description:
Get this message on multiple files but files all open w/o problem in MS Access 2010
The file 'Bolts, Nuts  and Screws.mdb' is corrupt and therefore cannot be opened. LibreOffice can try to repair the file.
etc.

Steps to Reproduce:
1.try opening .mdb file from Open Files
2.
3.

Actual Results:
error message as above

Expected Results:
To display tables, etc


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Totale fresh install of Libreoffice
Comment 1 raal 2023-10-02 16:04:23 UTC
I'm not Base expert, but please see https://ask.libreoffice.org/t/how-to-opening-mdb-files/48095
Comment 2 Robert Großkopf 2023-10-02 17:56:05 UTC
You have to create a *.odb-file (Base) to connect to a database file for access (*.mdb). Only tables and views from *.mdb-file will be available in *.odb-file.

Have a look here:
https://wiki.documentfoundation.org/Faq/Base/How_to_connect_to_a_Microsoft_Access_database
Comment 3 ilya.y.komarov 2023-10-05 15:46:46 UTC
I was able to reproduce this bug in:

Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: CL threaded

and 

Version: 24.2.0.0.alpha0+ (x86) / LibreOffice Community
Build ID: 2902ab24ecc5ffbf4907ea83b2028508b9de6364
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: CL threaded


I've tried 3 different files. I also got the file is corrupt and therefore cannot be opened. LibreOffice can try to repair the file for all of them.


1. open LibreOffice.
2. create a new .odb file.
3. open any .mdb file.

Expected result - File opens.
Actual result - Error message.

Edition	Windows 10 Pro
Version	22H2
Installed on	‎2021-‎03-‎11
OS build	19045.3448
Experience	Windows Feature Experience Pack 1000.19044.1000.0
Comment 4 Robert Großkopf 2023-10-05 18:16:58 UTC
(In reply to ilya.y.komarov from comment #3)> 
> 
> 1. open LibreOffice.
> 2. create a new .odb file.
> 3. open any .mdb file.

Step 2: Create a new odb-file, which connects to an external database. This should be the Access file. Under Windows you might get direct the connection to the *.mdb-file from the obd-file. With Linux you have to connect through JDBC by https://ucanaccess.sourceforge.net/site.html

LibreOffice won't open the *.mdb-file directly. Base would connect to the tables and views, but all other content won't be shown. When reading the description with
"Step 3: Open any .mdb file"
it seems you don't connect through Base to the file but try to open the *.mdb-file directly.
Comment 5 garth.hutchinson 2023-10-10 22:02:04 UTC
Item #1: 
I should have printed the entire messages

    The file 'Hymns.mdb' is corrupt and therefore cannot be opened. LibreOffice can try to repair the file.
    The corruption could be the result of document manipulation or of structural document damage due to data transmission.
    We recommend that you do not trust the content of the repaired document.
    Execution of macros is disabled for this document.
    Should LibreOffice attempt to repair the file?

This message is in error because the file is NOT CORRUPT.  The same happens with .accdb files.  These files are processable by MS Access and have valid internal signatures in the files: x(000100) + "Standard Jet DB" for .mdb;  x(000100) + :Standard ACE DB" for .accdb.  LibreOffice should either open it (as such utilities as MDBViewer can) or otherwise the messages should be "File type .xxxxx is not supported for direct reading" or some such.

Item #2:
Re reply to Ilya:  connecting a new .odb file to Hymns.mdb, going through the process and using the table wizard, I get the message

    The connection to the data source "Hymns" could not be established.
    The connection could not be created. Maybe the necessary data provider is not installed?

    More …

on clicking More I get the additional message

    SQL Status: HY000
    The connection could not be created. Maybe the necessary data provider is not installed?

on exiting this message  (the first time only, afterwards unless you delete the .odb file, then you do not) you get this message

    JRE Required

    LibreOffice requires a 64-bit Java runtime environment (JRE) to perform this task. Please install a JRE and restart LibreOffice. https://hub.libreoffice.org/InstallJava/?LOlocale=en-GB

installed the right JRE and same result.

Checked the ODBC Data Source Administrator (64-bit) and found, among others that for MS Access Database on 64-bit Platform there is installed "Microsoft Access Driver (*.mdb, *.accdb).  Surely you don't have to set up System DSN for each file!
Comment 6 jcsanz 2023-10-11 08:35:04 UTC
Can you provide a sample file that don't work for you, to test it?

The file can be as simple as a file with just a table with just a couple of fields.

I suspect you are not doing the right process to open the file and/or do not have installed necessary infrastructure to do it.

Also, you haven't inform about the OS, although I suspect it is Windows ??
Comment 7 garth.hutchinson 2023-10-11 13:48:45 UTC
See 
 https://ask.libreoffice.org/t/mdb-files-not-loading-to-base/30942
as possible solution; I have other priorities at the moment, but I recall that this worked for me some years ago.
Garth
Comment 8 garth.hutchinson 2023-10-11 14:27:01 UTC
Created attachment 190139 [details]
Zip file containing .mdf and .accdb files

Windows 10 Pro 64-bit running on HP Elitebook Core-i7 4th generation 8 gig memmory

see my comment this a.m. and the link

https://ask.libreoffice.org/t/mdb-files-not-loading-to-base/30942
Comment 9 garth.hutchinson 2023-10-29 00:14:02 UTC
OK - updated JRE, checked all needed options in place and connected successfully to hymns-backup.accdb file but not to hymns.mdb file.
Have one idea as to the cause.
There are two flavours of .mdb files - have run into this before in other connections (my memory is a little hazy where MS Access 2007 fits in the discussion below.
Flavour 1 (or, Flavor 1, if you prefer): a file that has been created and/or updated only by MS Access 97/2000/2003 and MAYBE 2007 - this can be opened again and again by those versions.
Flavour 2: a file that has been created by any of  the above and then
   a. updated by MS Access 2010/13/16; will no longer be able to be opened by MS Access 1997/2000/2003 and MAYBE 2007
The MAYBE comes in that MS Access 2007 is neutral in all this or whether it falls in same catecory as 2010 plus; but I think it is neutral because I vaguely remember using to created a downward compatible version of a .mdb file
I can research this later but need to set up a couple of VM's with old versions of MS Access on them.
Comment 10 Lionel Elie Mamane 2024-07-05 15:09:53 UTC
Is this maybe fixed with the commit that fixed tdf#158056?

https://gerrit.libreoffice.org/165756

https://git.libreoffice.org/core/commit/7edca7dc740f6877fa85c2a996ca869c6b971a48

tdf#158056 Connect to MS Access .mdb files by mean of ACE.OLEDB.12.0 provider
Comment 11 jcsanz 2024-07-07 13:50:55 UTC
Yes, I think it is solved (tested with both sample files without any problem).
So let's close it.
Comment 12 garth.hutchinson 2024-07-07 23:46:36 UTC
AGREED THAT IT SHOULD BE MARKED AS FIXED.
I HAD NO PROBLEM WITH .ACCDB FILE BUT WEIRD RESULT WITH .MDB WHICH MUST BE MY PROBLEM -- BUT ANY HINTS WOULD BE DEEPLY APPRECIATED.
--------------
When I try to connect to hymns.mdb I get the follow message:
_________________________________________________________________
| The connection to the data source "Hymns" could not be established
| at
| C:/cygwin64/home/buildslave/source/libo-core/dbccess/source/ui/mi
|
| The connection could not be created.  Maybe the necessary data provider is not 
| installed at
| C:/cygwin64/home/buildslave/source/libo-core/connectivity/source/commontools
| /dbexception.cxx:403
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When I click on [more] I get the list of 2 errors; the first has this description:
________________________________________________________
| The connection to the data source "Hymns" 
| could not be established at 
| C:/cygwin64/home/buildslave/source/libo-
| core/dbaccess/source/ui/misc/
| datasoourceconnector.cxx:177
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and the second has this
_________________________________________________________
| SQL Status HY000
|
| The connection could not be created. Maybe
| the necessary data provider is not installed at
| C:/cygwin64/home/buildslave/source/libo-
| core/connectivity/source/commontools
| /dbexception.cxx:403
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NOTE 1: there is no such folder as C:/cygwin64/…  on my PC.
NOTE 2: my ODBC entry, 64 bit, includes under User DSN
  Access Files    64bit    Microsoft Access Driver (*.mdb, *.accdb)
  but there is no speCific reference to the Hymns.mdb in File DSN or elsewherre.
Comment 13 jcsanz 2024-07-08 08:32:05 UTC
(In reply to garth.hutchinson from comment #12)
> AGREED THAT IT SHOULD BE MARKED AS FIXED.
> I HAD NO PROBLEM WITH .ACCDB FILE BUT WEIRD RESULT WITH .MDB WHICH MUST BE
> MY PROBLEM -- BUT ANY HINTS WOULD BE DEEPLY APPRECIATED.
Please, don't write in upper case...
> --------------
> When I try to connect to hymns.mdb I get the follow message:
...
> | The connection could not be created.  Maybe the necessary data provider is
> not 
> | installed at

The commit https://git.libreoffice.org/core/commit/7edca7dc740f6877fa85c2a996ca869c6b971a48 (
tdf#158056 Connect to MS Access .mdb files by mean of ACE.OLEDB.12.0 provider) is done precisely to solve the absence of some old providers to access to mdb files.
Now, with just one more updated provider (ACE.OLEDB.12.0 provider) you ca access *.mdb and *.accdb files. *But you need to install that provider*, it is not supplied with LibreOffice and never has been.
I'd tested both of your sample files before mark this bug as fixed
Comment 14 garth.hutchinson 2024-07-10 14:01:43 UTC
Thanks jcsanz
Note:
The ACE.OLEDB.12.0 provider is also installed when you download and install the 2016 viersions (16.0)
79 - over and uut
Garth
Comment 15 jcsanz 2024-07-10 14:52:42 UTC
(In reply to garth.hutchinson from comment #14)

> The ACE.OLEDB.12.0 provider is also installed when you download and install
> the 2016 viersions (16.0)

Yes, I know, and actually now that is the only way to obtain ACE.OLEDB.12.0, but I've continuing using that just in case somebody could have it because an old installation of Access. 

But now is very easy to update to use the ACE.OLEDB.16.0 provider