Clients and Server. Clients and servers A server provides a service such as dispensing files. A client calls on a service. The distinction is not hard.

Slides:



Advertisements
Similar presentations
1 Senn, Information Technology, 3 rd Edition © 2004 Pearson Prentice Hall James A. Senns Information Technology, 3 rd Edition Chapter 7 Enterprise Databases.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Configuration management
Chapter 10: Designing Databases
Database System Concepts and Architecture
CE203 - Application Programming Autumn 2013CE203 Part 51 Part 5.
Java II--Copyright © Tom Hunter. Chapter 18 JDBC.
Database Management3-1 L3 Database Management Santa R. Susarapu Ph.D. Student Virginia Commonwealth University.
Technical Architectures
JDBC - Java Database Connectivity The objectives of this chapter are: To describe the architecture of JDBC To outline the classes in the java.sql package.
Distributed Databases Logical next step in geographically dispersed organisations goal is to provide location transparency starting point = a set of decentralised.
Databases. Database Information is not useful if not organized In database, data are organized in a way that people find meaningful and useful. Database.
Distributed Application Development B. Ramamurthy.
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
Chapter 3 Database Management
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
1 Lecture 29 More on JDBC Overview  Objectives of this lecture  JDBC and its Drivers  Connecting to Databases (Java’s Connection class)  Querying a.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Client/Server Architecture
Chapter 1 Introduction to Databases
Distributed Databases
Introduction to Databases Transparencies 1. ©Pearson Education 2009 Objectives Common uses of database systems. Meaning of the term database. Meaning.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
Java Database Connectivity Vijayan Sugumaran Department of DIS Oakland University.
© Wang Bin 2004 JDBC ----Java Database Connectivity.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Java Database Connectivity ASE. Java Database Connectivity (JDBC) l JDBC – provides an interface to Relational Data Sources l JDBC library provides the.
Database Programming in Java Corresponds with Chapter 32, 33.
Introduction to distributed systems Dr. S. Indran 23 January 2004.
CST203-2 Database Management Systems Lecture 2. One Tier Architecture Eg: In this scenario, a workgroup database is stored in a shared location on a single.
Active Server Pages ASP is Microsoft’s server-side script engine for dynamically-generated web pages. Most common language used is VBScript. If you use.
1 Adapted from Pearson Prentice Hall Adapted form James A. Senn’s Information Technology, 3 rd Edition Chapter 7 Enterprise Databases and Data Warehouses.
Designing and Developing WS B. Ramamurthy. Plans We will examine the resources available for development of JAX-WS based web services. We need an IDE,
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Lecture # 3 & 4 Chapter # 2 Database System Concepts and Architecture Muhammad Emran Database Systems 1.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
Lesson Overview 3.1 Components of the DBMS 3.1 Components of the DBMS 3.2 Components of The Database Application 3.2 Components of The Database Application.
Java Database Connectivity (JDBC). Topics 1. The Vendor Variation Problem 2. SQL and Versions of JDBC 3. Creating an ODBC Data Source 4. Simple Database.
DATABASE MANAGEMENT SYSTEM ARCHITECTURE
JDBC Database Programming in Java Prepared by., Mrs.S.Amudha AP/SWE.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
DataBases and SQL INFSY 547 Spring Course Wrap Up April 12: Complete Work on Servlets Review of Team Projects Close of Portfolio Work April 19:
Database Access Using JDBC BCIS 3680 Enterprise Programming.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
© 2003 Prentice Hall, Inc.3-1 Chapter 3 Database Management Information Systems Today Leonard Jessup and Joseph Valacich.
Basics of JDBC Session 14.
Ch. NoNameMarks 01AWT24 02Networking18 03JDBC20 04Swing18 05Servlet20 Advance Java Programming.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Java Database Connectivity.
1 Information Retrieval and Use De-normalisation and Distributed database systems Geoff Leese September 2008, revised October 2009.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
E-commerce Architecture Ayşe Başar Bener. Client Server Architecture E-commerce is based on client/ server architecture –Client processes requesting service.
James A. Senn’s Information Technology, 3rd Edition
JDBC Database Management Database connectivity
Web Technologies IT230 Dr Mohamed Habib.
The Client/Server Database Environment
Introduction to Server-Side Web Development using JSP and Databases
Data Base System Lecture 2: Introduction to Database
Interacting with Database
MANAGING DATA RESOURCES
MSIS 655 Advanced Business Applications Programming
Data Model.
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Presentation transcript:

Clients and Server

Clients and servers A server provides a service such as dispensing files. A client calls on a service. The distinction is not hard and fast a server may act as a client to another server.

A server acting as a client In an ecommerce application a Web server might call on the service of a database server in order to access some data such as catalogue records

Some servers File servers Database servers Groupware servers Web servers Mail servers Object servers Print servers

Web servers In ecommerce terms the most important type of server Deal with in detail later Stores HTML files and dispenses them to clients Processes forms details Communicates with other servers, for example database servers

Database servers Next to web servers the most important type of server for ecommerce Explained in more detail later Stores relational databases Responds to queries in language called SQL

Tiered archtiectures An example of separation of concerns. Most popular model has three layers Developed for maintenance reasons

Three-tier model Business objects Business objects Database Clients Presentation layer Processing layer Data layer

Three tiers Presentation layer contains HCI for client Processing layer contains business objects Data layer contains some stored data

Rationale HCI can go on the client and does not require to be transmitted over network Business objects reflect domain entities Business objects shield the implementation of data

Business objects Reflect entities in application, for example in a sales site: catalogue, product and customer All application programming done on business objects Details of underlying data hidden to the application programmer, for example the programmer should be unaware of the database technology

Database Servers

Database servers Have been in existence for some time. Described here as they play a major part in ecommerce systems Virtually all based on the relational model

Relational tables ItemId Item NoInStock Aw222 Washer A 300 Ntr444 Nut A2009 Edt666 Spanner S802 Bt555qw Bolt B200 Key Each row contains associated data

SQL Structured Query Language In existence for many years Used to create, modify and retrieve data from relational tables No standardised

An example Select EmployeeName, Salary From Employees WHERE Salary>3500 Names of columns Name of table Condition

Typical configuration Web server Database server Clients

Functions of a database server Interpret SQL statements and execute them Optimise queries To prevent concurrency errors To detect deadlock To administer security To administer backup

Stored procedures Snippets of compiled code which are equivalent to subroutines Stored at server Efficient alternative to sending large numbers of SQL statements over communication media

Stored procedures: for and against Plus More efficient in processing time Reduces network traffic Keeps database code close to the database Minus They are non- standard Optimisation needs to be repeated as access strategies to a database change

Referential integrity Tables in a relational database are consistent with each other Associated with business rules Two ways of implementing it: declarative referential integrity and trigger-based referential integrity

Implementation Declarative referential integrity is maintained by declarations in database schemas Trigger based referential integrity is achieved by embedding code

Pros and cons Trigger based Non-standard Triggers found scattered throughout a system Some implementations have upper limit to number of triggers Declaration based Self-documenting Standard

Relational middleware Server software Server software Clients Database SQL API Driver Stacks

The components The API provides programmer facilities The driver communicates SQL statements to the server software The stack contains protocol software Server software carries out the main functions, for example executing SQL queries

Distributed databases Databases spread around servers in a distributed system Databases distributed for performance reasons: keeping data close to clients Distributed for reliability using replicated data Distributed because of legacy: many systems have evolved from separate systems

Problems with distributed data Keeping replicated data up-to-date Ensuring concurrent access keeps a database in its correct state Security is a big headache Reliability is a problem Clock synchronisation is a problem

Types of distribution Downloading: periodically writing data to a remote database Data replication: keeping identical sets of data in step Fragmentation: splitting data into sub- tables.

Fragmentation Horizontal fragmentation, splitting tables lengthways - split tables have the same columns as original table Vertical fragmentation, where the split tables are associated with a subset of the columns of the original table

Java as a medium for database development (i) Driver, used for database drivers Statement, an SQL statement PreparedStatement, compiled SQL statements CallableStatement, stored procedure

Java as a medium for database development (ii) Connection, facilities for connecting to a database ResultSet, collection of data retrieved from a query DatabaseMetaData, data about a database DriverManager, manages connections to a database

Developing Java code to access a database Load a driver Establish a database connection Associate an SQL statement with this connection Execute the statement Process a result set Close the connection

Loading the driver //Set the name of the file that is to be accessed //and the name of the driver String fileURL =...; String driverName =...; try { // Load in the driver programmatically Class.forName(driverName); } catch (ClassNotFoundException cfn) { //Problem with driver, display error message and //return to operating system with status value 1 System.out.println(Problem loading driver); System.exit(1); }

Establishing a connection try { //Establish a connection to the database, second //argument is the name of the user and the third //argument is a password (blank) Connection con = DriverManager.getConnection(fileURL, Darrel,);

Create and execute an SQL statement // Create a statement object Statement selectStatement = con.createStatement(); // Execute the SQL select statement ResultSet rs = selectStatement.executeQuery (SELECT name, salary FROM employees WHERE salary >35000");

Process the result set String employeeName; int employeeSalary; while(rs.next()) { employeeName = rs.getString(1); employeeSalary = rs.getInt(2); System.out.println(Name = + employeeName + Salary = + employeeSalary); }

Close down connections //Close down the database connection, result set //and the SELECT statement selectStatement.close(); con.close(); rs.close();

Meta data Data about data Can be data about a database, a result set or a driver Java contains classes which enable such data to be easily extracted

An example Connection c; // Code to establish a connection DatabaseMetaData dmd = c.getMetaData(); System.out.println(Driver is + dmd.getDriverName() + Version number = +dmd.getDriverVersion()); Obtaining data about the driver: its name and version number

Three tier with relational database Clients Business objects Relational databases Mapping

Mappings Classes usually mapped to tables Instance variables to columns Relationships to common data in tables