Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd
1-Tier Architecture• In 1-Tier Architecture the file you want to work with must be accessible from a local or shared drive• This is the simplest of all the architectures, but also the least secure• Since users have direct access to the files, they could accidentally modify, delete the file by accident or on purpose• So 1-tier architecture is simple and cheap, but usually unsecured and data can easily be lost if you are not careful
2-Tier Architecture• This architecture is also called Client-Server architecture because of the two components• The client that runs the application and the server that handles the database back-end• The client computer usually can’t see the database directly and can only access the data by starting the client• This means that the data on the server is much more secure• Now users are unable to change or delete data unless they have specific user rights to do so
2-Tier Architecture• The client-server solution also allows multiple users to access the database at the same time• One other huge benefit is that the server is processing data that allows the client to work on the presentation and business logic only• This mean that the client and the server is sharing the workload and by scaling the server to be more powerful than the client• you are usually able to load many clients to the server allowing more users to work on the system at the same time.
3-Tier Architecture• This involves one more layer called the business logic tier, service tier or middle tier (layer)• In the client-server solution the client was handling the business logic and that makes the client “thick”• A thick client means that it requires heavy traffic with the server, thus making it difficult to use over slower network connections like Internet and Wireless• This means that only little communication is needed between the client and the middle tier making the client “thin” or “thinner”• An example of a thin client is an Internet browser that allows you to see and provide information fast and almost with no delay
3-Tier Architecture• As more users access the system a three-tier solution is more scalable than the other solutions because you can add as many middle tiers (running on each own server) as needed to ensure good performance (N-tier or multiple-tier).
3-Tier Architecture• Security is also the best in the three-tier architecture because the middle layer protects the database tier• There is one major drawback to the N-tier architecture and that is that the additional tiers increase the complexity and cost of the installation
Differences among 1-Tier,2-Tier,3-Tier Architecture 1-Tier 2-Tier Multi-TierBenefits Very simple Good security Exceptional Inexpensive More scalable security Fastest No server Faster execution execution needed “Thin” client Very scalable Issues Poor security More costly Very costly Multi user issues More complex Very complex “Thick” client Users Usually 1 (or a 2-100 50-2000 (+) few)
3-Tier Architecturefrom transferobj import tobj UIfrom Blogic import Blogicclass gui: def userip(self): print enter the Airline code self.int_Airline_Code=raw_input() print enter the Airline Name self.vchr_Airline_Name=raw_input() print enter the Airline Numeric Code self.int_Airline_Numeric_Code=raw_input() tob=tobj() tob._init_(self.int_Airline_Code,self.vchr_Airline_Name,self.int_Airline_Numeric_Code) b=Blogic() b.getdata(tob)
3-Tier Architecture DataBasefrom transferobj import tobjimport psycopg2import sys#Define our connection stringconn_string = " dbname=firstdb"# print the connection string we will use to connectprint "Connecting to databasen ->%s" % (conn_string)# get a connection, if a connect cannot be made an exception will be raised hereconn = psycopg2.connect(conn_string)# conn.cursor will return a cursor object, you can use this cursor to perform queriescursor = conn.cursor()print "Connected!n"
3-Tier Architecture DataBaseclass Data: def getdetails(self,tob): self.int_Airline_Code=tob.int_Airline_Code self.vchr_Airline_Name=tob.vchr_Airline_Name self.int_Airline_Numeric_Code=tob.int_Airline_Numeric_Codecursor.execute("insert into tbl_Airlines values(%s,%s,%s)",(self.int_Airline_Code,self.vchr_Airline_Name,self.int_Airline_Numeric_Code))cursor.execute("select * from tbl_Airlines");result=cursor.fetchall()print resultconn.commit()