Best way to access a remote database: via webservice or direct DB access?

I am looking for application development for Mac and iOS devices. The application will rely on information stored in a remote database. It requires both reading (selecting) and writing (inserting, updating, deleting) to the database. The application will be a multi-user application.

Now I am considering two different approaches to accessing the database: - through the web service: the application accesses the web service (REST, JSON), which accesses the database. Authentication will be done through HTTP authentication through SSL (https). - access to a remote database directly via VPN.

The application will be used by a maximum of, say, 100 people and is intended for small groups / organizations / enterprises.

So my question is: what's the best approach to accessing a database? How about security and performance? What is a typical small business implementation?

Any advice would be appreciated.

thanks

+5
source share
2 answers

Using web services adds a level of indirection between clients and the database. This has a number of advantages associated with the fact that customers do not need to know the database, only your web service interface. Because client applications are more difficult to control and update than your server-side code, it pays to add a level of business logic to the server that allows you to configure your system without pushing updates for clients. Main advantages:

  • Flexibility - you can completely change the configuration of the database or replace the data layer and not change anything in client applications, while you keep the same web service interface.
  • Security - implement an authentication mechanism for your web services and not provide clients with access to credentials for your database engine.

There are some drawbacks: you pay for this flexibility by adding a level of complexity - it will probably be faster to simply encode the database access in the clients and execute with it. Consider the level of web services as an investment that can pay dividends on the way. Is it worth it that it really depends on your business requirements and prospects.

+3
source

Given the information you provided, the answer is almost certainly web services if the VPN is not working fast.

If the VPN is fast enough to handle traffic, you will save a lot of time, effort and expense by accessing the database directly from your application.

You can also provide remote access to virtual PC sessions if this is your thing.

So, it all depends on your requirements. There are many ways to do this, and each has its own advantages and disadvantages. The correct solution will require a significant amount of system analysis, possibly beyond the scope of the question posted in StackOverflow.

+1
source

Source: https://habr.com/ru/post/922853/


All Articles