Take the 2-minute tour ×

I am designing a database for an application, which will be accessed by different front end programming languages, such as php, asp.net, 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

1 Answer 1

up vote 2 down vote accepted

If you were only talking about accessing the database via PHP and ASP.net, 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 asp.net 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 ASP.net 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


