0

Hi I am having some trouble understanding how the data access tier and the logic tier interact within the architecture. For the record the application will be an Android exclusive social network

  1. The presentation tier is an Android device
  2. The logic tier will be a RESTful API being consumed by the Mobile Device. this tier will use JavaEE JAX-RS/Jersey/Tomcat located on server A
  3. The data tier is a MySQL DB using JavaEE JPA/Hibernate located on server B

From my understanding the Data tier "delivers" JSON containing the data back to the business tier which then parses/performs whatever computations on the JSON

What confuses me is, what is the deliverable from the logic tier? What should the logic tier actually send to the data tier, I mean ultimately all the logic tier should need to do request from the data tier is "I need this data" right? But what form should this request take?

What is N-Tier architecture? seems to indicate JSON or some kind of encrypted data containing an SQL query (I cannot/should not execute the query from the logic tier as it is on a seperate machine to the DB). But is it ok to send a DB request over the web from the business logic tier to the data tier?

I have also looked at DTO/DAOs which sound like they may be the solution I am searching for, but I am unsure.

Thanks for any help you can offer!

Community
  • 1
  • 1
FinalFind
  • 131
  • 1
  • 6
  • In the presentation layer there is the client but also the Web Server (Tomcat).. The server have 3 layer presentatio/b.logic/data. – DevOps85 Jul 13 '15 at 12:46
  • See this link, this should give you an idea, https://www.ibm.com/developerworks/library/wa-aj-multitier/#1.3.A Multi -tier Architecture for Building RESTful Web Services|outline, perhaps for web. And the only change would be the client tier being a mobile APP. – arunvg Jul 13 '15 at 12:48
  • Ok thanks, I will have a look. I am getting quite confused with how to connect the DAL which is on a seperate tier (i.e. a seperate server) to the Database, how do I connect to the database from the DAL as you cannot (or atleast should not) connect to a DB from a remote server. – FinalFind Jul 13 '15 at 14:06
  • "you cannot (or atleast should not) connect to a DB from a remote server"- What is your consideration here ? Usually we connect using JDBC (oriented towards relational databases) or the client apis provided by the datastores (in case of NOSQL databases) – arunvg Jul 14 '15 at 04:23
  • Well, we have 3 tiers, and each tier is a seperate machine/server, so surely if the DAL is on one machine (the same machine as the BLL in the case of your link), and the DB is on another, I have to access the DB remotely from the DAL. I.E. into JDBC in the DAL I would have to put the external IP of the machine with the DBMS and it was my understanding that DBs should always be accessed by localhost – FinalFind Jul 14 '15 at 14:31
  • I will just give you a bit more, following on from that point, say this line; jdbc:mysql://localhost:3306 If, as the diagram in your link suggests, I have the DB on one tier (i.e. seperate server) and the DAL and Business logic on another tier (i.e. another server) how the heck would I connect hibernate to the DB i.e. hook up my persistence layer to my DB as putting localhost on the business logic server would be incorrect. Or am I wrong in thinking that this should always be localhost? Maybe its only with JDBC directly that this applies? – FinalFind Jul 14 '15 at 23:44

0 Answers0