locked
Does mdb in ASP.Net's App_Data work in Microsoft App Service (web App) ? RRS feed

  • Question

  • User-775831949 posted

    My ASP.Net site is to be published to Azure App Service (formerly called Web App) and it is using mdb file as db in App_Data.

    I wish to know if Azure App Service allow mdb ( Jet4.0 ) on it ? Will it run into Access 4.0 not installed on this machine error ?

    Any one got experience ?

    Tuesday, June 11, 2019 12:53 PM

Answers

  • User61956409 posted

    Hi hkbeer,

    I wish to know if Azure App Service allow mdb ( Jet4.0 ) on it ? Will it run into Access 4.0 not installed on this machine error ?

    I did a test with following code snippet on Azure App Service, which can work well.

    var f_path = Server.MapPath("~/App_Data") + @"\Database1.mdb";
    
    string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + f_path;
    string strSQL = "SELECT count(1) FROM TABEMPLOYEE";
    
    using (OleDbConnection connection = new OleDbConnection(connectionString))
    {
        OleDbCommand command = new OleDbCommand(strSQL, connection);
    
        connection.Open();
        var count = (int)command.ExecuteScalar();
        connection.Close();
    
        lbl_count.Text = count.ToString();
    }

    Test Result

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 12, 2019 2:56 AM
  • User61956409 posted

    Hi hkbeer,

    How about the web.config data connection string. How to set it ?

    You can try to set it, like below.

    <connectionStrings>
      <add name="myConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Master.mdb" providerName="System.Data.OleDb"/>
    </connectionStrings>

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 12, 2019 5:24 AM

All replies

  • User-821857111 posted

    According to this: https://feedback.azure.com/forums/169385-web-apps/suggestions/17259710-usage-of-registration-free-activation-of-com-com, Jet will not work in Azure Web Apps.

    Tuesday, June 11, 2019 1:02 PM
  • User-775831949 posted

    Thanks. I read an article before they support mdb (Jet 4.0) but not accdb (OLEDB 12.0).

    So I wish to see any one tried mdb on Web App platform before for their ASP.net apps on it.

    Tuesday, June 11, 2019 2:16 PM
  • User753101303 posted

    Hi,

    No, it's really outdated and never saw someone being able to use that with App Services.

    It make me think that at some point I wanted to give a try at https://docs.microsoft.com/en-us/dotnet/api/system.data.common.dbproviderfactories.getfactoryclasses?view=netframework-4.8 to see what happens. I'll definitively try.

    Tuesday, June 11, 2019 2:22 PM
  • User753101303 posted

    It's quite easy to try yourself. Could you point us to this article ? I find this really surprising. If I remember you still have a "cloud services" option that offers some more control (is this maybe what this article is talking about) and of course the VM option that allows to do whatever you want...

    Edit: I remember to have noticed also an EF Core provider for Access. See https://docs.microsoft.com/en-us/ef/core/providers/ and check maybe the EntityFrameworkCore.Jet provider. You are just starting or worked a bit already on this app ?

    Tuesday, June 11, 2019 2:26 PM
  • User61956409 posted

    Hi hkbeer,

    I wish to know if Azure App Service allow mdb ( Jet4.0 ) on it ? Will it run into Access 4.0 not installed on this machine error ?

    I did a test with following code snippet on Azure App Service, which can work well.

    var f_path = Server.MapPath("~/App_Data") + @"\Database1.mdb";
    
    string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + f_path;
    string strSQL = "SELECT count(1) FROM TABEMPLOYEE";
    
    using (OleDbConnection connection = new OleDbConnection(connectionString))
    {
        OleDbCommand command = new OleDbCommand(strSQL, connection);
    
        connection.Open();
        var count = (int)command.ExecuteScalar();
        connection.Close();
    
        lbl_count.Text = count.ToString();
    }

    Test Result

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 12, 2019 2:56 AM
  • User-775831949 posted

    This is great !! Thanks.

    How about the web.config data connection string. How to set it ?

    In my VS it is

    connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Master.mdb"

    How should I modify it ? Thanks

    Wednesday, June 12, 2019 3:17 AM
  • User61956409 posted

    Hi hkbeer,

    How about the web.config data connection string. How to set it ?

    You can try to set it, like below.

    <connectionStrings>
      <add name="myConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Master.mdb" providerName="System.Data.OleDb"/>
    </connectionStrings>

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 12, 2019 5:24 AM
  • User-775831949 posted

    Thanks a lot. This is great

    Wednesday, June 12, 2019 5:33 AM
  • User1120430333 posted

    Thanks a lot. This is great

    I think you're going to have a lot of problems with Access in a multi user environment, because it is very corruptible in  the environment. You will spend time repairing the database on a routine basis. I found that out the hard way. But I resolved the issues with Access by converting the database to MS SQL Sever and never looked back to Access again. 

    Wednesday, June 12, 2019 6:23 AM
  • User753101303 posted

    I tested as well and confirm that - to my surprise - it works fine. I listed as well .NET providers and what seems to be installed OleDb providers at https://patricesc-net4.azurewebsites.net/

    Wednesday, June 12, 2019 11:47 PM
  • User-775831949 posted
    Once again thanks all.
    In fact I also goto App Service page and talk to their online service agent to ask them add OLEDB12 accdb in it

    But seems so far they dont see any request so they seems not so caring. Pls help to get therevand make more request over the real time chat apps to request for it hopefully they could add that too. Mdb cannot connect xlsx ..but accdb can so it is also something we need...

    Thanks all
    Thursday, June 13, 2019 5:23 AM
  • User1120430333 posted

    Once again thanks all.
    In fact I also goto App Service page and talk to their online service agent to ask them add OLEDB12 accdb in it

    But seems so far they dont see any request so they seems not so caring. Pls help to get therevand make more request over the real time chat apps to request for it hopefully they could add that too. Mdb cannot connect xlsx ..but accdb can so it is also something we need...

    Thanks all

    I doubt there is going to be too much support for 30 some years old legacy COM technology. 

    Thursday, June 13, 2019 6:53 AM
  • User753101303 posted

    Even if it works it is a still a file  based format intended primilarly for  a desktop product.

    You have seen the other https://azure.microsoft.com/en-us/services/#databases options? 

    Thursday, June 13, 2019 8:12 AM
  • User-821857111 posted

    Mdb cannot connect xlsx
    You should use something like EPPlus to work with xlsx files. It's a Nuget package so it gets included in your bin folder and doesn't require anything to be installed on the web server.

    https://www.mikesdotnetting.com/category/34/epplus

    Friday, June 14, 2019 8:49 AM
  • User-775831949 posted

    hkbeer

    Mdb cannot connect xlsx

    You should use something like EPPlus to work with xlsx files. It's a Nuget package so it gets included in your bin folder and doesn't require anything to be installed on the web server.

    https://www.mikesdotnetting.com/category/34/epplus

    Thanks  a lot Mike, I still need the mdb to calculate something on button click on page so this is something not possible with excel connect and thats why i need mdb connection.

    Saturday, June 15, 2019 6:22 AM