Database Design – Is It Possible to Keep One Database for Both Web and Desktop Applications?

apachegtklinuxMySQLPHP

I'm experiencing a trouble with my business model, let me explain better.

I'm developing a software for 1 year and few months, it's for the food industry, more exactly a software to: Delivery, Take Way, Table Reservation, POS, Accounts Payable and Receivable, Prints(receipt), Kitchen Monitors Orders, Customers Orders Control and Fiscal Area.

Well, I had separated the software mainly in two areas, one is web area and the other is desktop area (Used by Admins only) and local installed.

1 – Web Area (Basically do the follow:)

  • Show Catalog with the products
  • Customers Make Orders
  • Customers Pay for the Orders
  • etc … as mentioned above

2 – Desktop Area

  • Manage Orders
  • Manage Customers
  • Manage Suppliers
  • Manage Accounts Payable and Receivable
  • etc … as mentioned above

The web area is hosted in an online web server (scripts and database are online). The Desktop area is hosted locally in a Linux machine with a local database and local scripts files.

My question is:
Is it possible to keep only one Database for both applications? If YES, please what is the best approach?

Follow my technical specification environment

Database: Actually I have two databases working and I would love to keep only one.

Operating System: Linux (Kernel 2.6.X and above) or Windows (XP and above)

For the Web Area

  • Apache, PHP, Python, Java Script, Shell Script and MySQL.

For the Desktop Area:

  • PHP-GTK2, Apache, PHP, MySQL and Shell Script.

Addtional Information about the system [EDITED]

The main purposes to have a Desktop environment is:

  1. I need to print and give out Tax Coupon on each new order.
  2. I have the drawer.
  3. I have a serial reader (Bar code).
  4. I have a terminal to query for information.
  5. and few other stuffs that is so hard if not impossible to do in the web environment.

Desktop relational schema: 104 tables.
Web relational schema: 42 tables.

  1. Permissions is assigned based on: Deny all by default, and assigns as needed.
  2. (Validation / Sanitization) has already been done in the web application.
  3. Until now performance is not a problem, since every fiscal year part of my database will be archived.
    (Also customer, suppliers and all related data about them will be archived after 3 years of inactivity).

My real problem is I have 2 environments today and I would love to have only 1.
Then "merge" the both worlds into one is an option, but not sure about.
I would love to read here a lot of ideas about this matter.

Observation about the process: Today it is in operation and it works fine, but I feel like waste time in some process.

Take a look in the scenario:

  1. The order is made in the internet, then stored in my Web database.
  2. The "order" is sent to the kitchen and prepared.
  3. Print a receipt (Tax Coupon), put it with the order and delivery to the customer.
  4. A Tax Coupon is generated by my Desktop Environment and it need a call to the orders table, but it is not the Web Order Table but a Desktop Order Table.

In few words I need to generate again the order to fill up the Tax Coupon. The same happen to Customer Register, Supplier Register and few other stuffs.

I hope this information turn my question more readable. Thanks Again!

Best Answer

Short Answer: You would definitely have less headaches with a single database.

Otherwise, you may end-up with record synchronization issues, as well as with record duplicates, in all local databases that you might use.

What would you need is just to create a DAL (data access layer) and make your client applications (desktop, wen, mobile, etc) access your database through your DAL.

Related Topic