tdf#158056 Connect to MS Access .mdb files by mean of ACE.OLEDB.12.0 provider
* Modify the code so that all connections to MS Access files, both .mdb
and .accdb are made with the provider "Microsoft.ACE.OLEDB.12.0".
* Remove all references to the "Microsoft.Jet.OLEDB.4.0" provider to clean
up the code.
* Leave only one entry "Microsoft Access" in the Connection Wizard, which
would work for .mdb and .accdb files.
* Remove the entry "Microsoft Access 2007" from the Connection Wizard,
since it is no longer needed.
Change-Id: If523712d071199d61e0c994b35291d3a69246ad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165756
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu b/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu
index 288c23e..28f915f 100644
--- a/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu
+++ b/connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu
@@ -214,7 +214,7 @@
</node>
</node>
</node>
<node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">
<node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
<prop oor:name="Driver">
<value>com.sun.star.comp.sdbc.ado.ODriver</value>
</prop>
@@ -340,7 +340,7 @@
</node>
<node oor:name="Extension" oor:op="replace">
<prop oor:name="Value" oor:type="xs:string">
<value>mdb</value>
<value></value>
</prop>
</node>
<node oor:name="SupportsColumnDescription" oor:op="replace">
@@ -350,20 +350,5 @@
</node>
</node>
</node>
<node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">
<prop oor:name="ParentURLPattern">
<value>sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
<value xml:lang="en-US">Microsoft Access 2007</value>
</prop>
<node oor:name="MetaData">
<node oor:name="Extension" oor:op="replace">
<prop oor:name="Value" oor:type="xs:string">
<value></value>
</prop>
</node>
</node>
</node>
</node>
</oor:component-data>
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 686a9fe..b879e1b 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -121,9 +121,9 @@ void OConnection::construct(std::u16string_view url,const Sequence< PropertyValu
WpADOProperties aProps = m_aAdoConnection.get_Properties();
if(aProps.IsValid())
{
OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true);
OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true);
OLEVariant aVar(
OTools::getValue(aProps, std::u16string_view(u"Jet OLEDB:Engine Type")));
OTools::getValue(aProps, std::u16string_view(u"ACE OLEDB:Engine Type")));
if(!aVar.isNull() && !aVar.isEmpty())
m_nEngineType = aVar.getInt32();
}
@@ -184,7 +184,7 @@ OUString SAL_CALL OConnection::nativeSQL( const OUString& _sql )
WpADOProperties aProps = m_aAdoConnection.get_Properties();
if(aProps.IsValid())
{
OTools::putValue(aProps, std::u16string_view(u"Jet OLEDB:ODBC Parsing"), true);
OTools::putValue(aProps, std::u16string_view(u"ACE OLEDB:ODBC Parsing"), true);
WpADOCommand aCommand;
aCommand.Create();
aCommand.put_ActiveConnection(static_cast<IDispatch*>(m_aAdoConnection));
diff --git a/dbaccess/inc/strings.hrc b/dbaccess/inc/strings.hrc
index 0c6226e..0691ff9 100644
--- a/dbaccess/inc/strings.hrc
+++ b/dbaccess/inc/strings.hrc
@@ -293,7 +293,6 @@
#define STR_JDBCDRIVER_SUCCESS NC_("STR_JDBCDRIVER_SUCCESS", "The JDBC driver was loaded successfully.")
#define STR_JDBCDRIVER_NO_SUCCESS NC_("STR_JDBCDRIVER_NO_SUCCESS", "The JDBC driver could not be loaded.")
#define STR_MSACCESS_FILTERNAME NC_("STR_MSACCESS_FILTERNAME", "MS Access file")
#define STR_MSACCESS_2007_FILTERNAME NC_("STR_MSACCESS_2007_FILTERNAME", "MS Access 2007 file")
#define STR_FIREBIRD_FILTERNAME NC_("STR_FIREBIRD_FILTERNAME", "Firebird Database")
#define STR_RSC_CHARSETS NC_("STR_RSC_CHARSETS", "System")
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 2f74fd05..6a081c4 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -228,8 +228,7 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD
_rsHostname = sUrl.getToken(0,'/');
_sDatabaseName = sUrl.copy(sUrl.lastIndexOf('/')+1);
}
else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")
|| _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=") )
else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
{
OUString sNewFileName;
if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
@@ -339,10 +338,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(std::u16string_view _rDsn) con
{
if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
{
if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;"))
return DST_MSACCESS_2007;
else
return DST_MSACCESS;
return DST_MSACCESS;
}
return DST_ADO;
}
@@ -455,7 +451,6 @@ void ODsnTypeCollection::fillPageIds(std::u16string_view _sURL,std::vector<sal_I
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_LDAP);
break;
case DST_MSACCESS:
case DST_MSACCESS_2007:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MSACCESS);
break;
case DST_OUTLOOKEXP:
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index bea6553..ebd2870 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -55,7 +55,6 @@ enum DATASOURCE_TYPE
DST_EVOLUTION_LDAP = 19,
DST_KAB = 20,
DST_MACAB = 21,
DST_MSACCESS_2007 = 22,
DST_EMBEDDED_HSQLDB = 23,
DST_MYSQL_NATIVE = 24,
DST_MYSQL_NATIVE_DIRECT = 25,
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index f1d0fd5..66db8dc3 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -217,22 +217,11 @@ namespace dbaui
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
FileDialogFlags::NONE, GetFrameWeld());
aFileDlg.AddFilter(sFilterName,"*.mdb;*.mde");
aFileDlg.AddFilter(sFilterName,"*.accdb;*.accde;*.mdb;*.mde");
aFileDlg.SetCurrentFilter(sFilterName);
askForFileName(aFileDlg);
}
break;
case ::dbaccess::DST_MSACCESS_2007:
{
OUString sFilterName2(DBA_RES (STR_MSACCESS_2007_FILTERNAME));
::sfx2::FileDialogHelper aFileDlg(
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION,
FileDialogFlags::NONE, GetFrameWeld());
aFileDlg.AddFilter(sFilterName2,"*.accdb;*.accde");
aFileDlg.SetCurrentFilter(sFilterName2);
askForFileName(aFileDlg);
}
break;
case ::dbaccess::DST_MYSQL_ODBC:
case ::dbaccess::DST_ODBC:
{
@@ -659,7 +648,7 @@ namespace dbaui
const ::dbaccess::DATASOURCE_TYPE eType = m_pCollection->determineType(m_eType);
if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) || ( ::dbaccess::DST_MSACCESS_2007 == eType) )
if ( ( ::dbaccess::DST_CALC == eType) || ( ::dbaccess::DST_WRITER == eType) || ( ::dbaccess::DST_MSACCESS == eType) )
{
if( pathExists(sURL, true) == PATH_NOT_EXIST )
{
diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx
index 3980298..5570458 100644
--- a/dbaccess/source/ui/dlg/ConnectionPage.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx
@@ -105,7 +105,6 @@ namespace dbaui
m_xFT_Connection->set_label(DBA_RES(STR_COMMONURL));
break;
case ::dbaccess::DST_MSACCESS:
case ::dbaccess::DST_MSACCESS_2007:
m_xFT_Connection->set_label(DBA_RES(STR_MSACCESS_MDB_FILE));
m_xConnectionURL->set_help_id(HID_DSADMIN_MSACCESS_MDB_FILE);
break;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 5a630ce..3fa122b 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -465,7 +465,6 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const
case ::dbaccess::DST_WRITER:
break;
case ::dbaccess::DST_MSACCESS:
case ::dbaccess::DST_MSACCESS_2007:
{
OUString sFileName = pCollection->cutPrefix(pUrlItem->GetValue());
OUString sNewFileName;
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index 699cf4d..f34e58c 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -137,7 +137,6 @@ WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) c
case ::dbaccess::DST_KAB:
case ::dbaccess::DST_MACAB:
case ::dbaccess::DST_MSACCESS:
case ::dbaccess::DST_MSACCESS_2007:
case ::dbaccess::DST_JDBC:
case ::dbaccess::DST_CALC:
case ::dbaccess::DST_WRITER:
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 9693eee..ae5730d 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -485,7 +485,6 @@ enum class DBConnURIType
CALC,
DBASE,
FLAT,
MSJET,
MSACE,
WRITER
};
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index b3e9a93..ea58fcc 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -891,8 +891,7 @@
#define STR_FILTER_DOC NC_("STR_FILTER_DOC", "Microsoft Word")
#define STR_FILTER_TXT NC_("STR_FILTER_TXT", "Plain text")
#define STR_FILTER_CSV NC_("STR_FILTER_CSV", "Text Comma Separated")
#define STR_FILTER_MDB NC_("STR_FILTER_MDB", "Microsoft Access")
#define STR_FILTER_ACCDB NC_("STR_FILTER_ACCDB", "Microsoft Access 2007")
#define STR_FILTER_ACCDB NC_("STR_FILTER_ACCDB", "Microsoft Access")
#define ST_CONFIGUREMAIL NC_("ST_CONFIGUREMAIL", "In order to be able to send mail merge documents by email, %PRODUCTNAME requires information about the email account to be used.\n\nDo you want to enter email account information now?")
#define ST_FILTERNAME NC_("ST_FILTERNAME", "%PRODUCTNAME Address List (.csv)")
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 7c97db6..d7c11eb 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2571,11 +2571,8 @@ DBConnURIType GetDBunoType(const INetURLObject &rURL)
type = DBConnURIType::FLAT;
}
#ifdef _WIN32
else if (sExt.equalsIgnoreAsciiCase("mdb") || sExt.equalsIgnoreAsciiCase("mde"))
{
type = DBConnURIType::MSJET;
}
else if (sExt.equalsIgnoreAsciiCase("accdb") || sExt.equalsIgnoreAsciiCase("accde"))
else if (sExt.equalsIgnoreAsciiCase("accdb") || sExt.equalsIgnoreAsciiCase("accde")
|| sExt.equalsIgnoreAsciiCase("mdb") || sExt.equalsIgnoreAsciiCase("mde"))
{
type = DBConnURIType::MSACE;
}
@@ -2632,14 +2629,6 @@ uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType)
aURLAny <<= sDBURL;
}
break;
case DBConnURIType::MSJET:
#ifdef _WIN32
{
OUString sDBURL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + rURL.PathToFileName());
aURLAny <<= sDBURL;
}
#endif
break;
case DBConnURIType::MSACE:
#ifdef _WIN32
{
@@ -2698,7 +2687,6 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference
aTableFilterAny <<= aFilters;
}
break;
case DBConnURIType::MSJET:
case DBConnURIType::MSACE:
aSuppressVersionsAny <<= true;
break;
@@ -2805,8 +2793,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShel
{ SwResId(STR_FILTER_TXT), "*.txt" },
{ SwResId(STR_FILTER_CSV), "*.csv" },
#ifdef _WIN32
{ SwResId(STR_FILTER_MDB), "*.mdb;*.mde" },
{ SwResId(STR_FILTER_ACCDB), "*.accdb;*.accde" },
{ SwResId(STR_FILTER_ACCDB), "*.accdb;*.accde;*.mdb;*.mde" },
#endif
};