Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am designing a database for an application, which will be accessed by different front end programming languages, such as php,, android applications and iphone applications.

I am confused, whether is it good to accessing different programming languages directly to a database? and I learned somewhere, I have to create a middle layer between database (Backend) and Programming languages (Frontend).

  1. Is this middle layer indicating Stored Procedure?
  2. If it is not stored procedure what is required to create this middle layer?
  3. If my overall logic is wrong kindly suggest me any other method to solve this doubt.
  4. Is there anything related to middle layer which I need to concentrate while designing?

Thanks in advance.

share|improve this question
up vote 2 down vote accepted

If you were only talking about accessing the database via PHP and, then a stored procedure could serve as a common middle layer. Once you add the android and iphone applications into the equation, you're looking at having to design another middle layer. Reason for that it is most mobile devices don't have database drivers available to them.

In your case, you should build your middle layer in or PHP as a web service. Most are designing these web services as a REST API. You'll need to think about the information that your mobile apps need and build API endpoints for those things (users, posts, etc). I also recommend making your and PHP site/application use the same API your mobile apps do.

By setting up an API like this, you can reduce the work required for your apps. You're mobile app doesn't know that to get the latest 10 posts, it has to query SELECT * FROM posts order by create_date desc limit 10. It just has to make a request to http://myapi/posts/latest.

There are several posts on Stack Overflow and Programmers.SE about setting up Web Service APIs, I recommend reviewing them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.