14 - Client/ServerCSC4071 Systems Architecture Client-Server Systems.

Slides:



Advertisements
Similar presentations
Connecting to Databases. connecting to DB DB server typically a standalone application Server runs on localhost for smaller sites –i.e. Same machine as.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Chapter 9: The Client/Server Database Environment
Technical Architectures
Distributed Application Development B. Ramamurthy.
SQL (Structured Query Language) X/OPEN Call Level Interface For SQL ODBC (Open DataBase Connectivity) API JDBC (Java DataBase Connectivity) API SQL (Structured.
15-Jun-15 JDBC. JDBC is a Sun trademark It is often taken to stand for Java Database Connectivity Java is very standardized, but there are many versions.
ODBC and JDBC Aggie Hoversten CSCI Fall 1999.
Middleware Technologies compiled by: Thomas M. Cosley.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Systems Architecture: Client/Server Systems Naim R. El-Far, PhD Candidate TA for SEG3202 Software Design and Architecture with N. El-Kadri (Summer 2005)
1 © Prentice Hall, 2002 The Client/Server Database Environment.
Lecture The Client/Server Database Environment
Client/Server Computing. Information processing is distributed among several workstations and servers on a network, with each function being assigned.
JDBC Java API for Database Connectivity. Layout of this recitation Introduction to JDBC API JDBC Architecture Understanding the design of JDBC API –Classes.
The Client/Server Database Environment
Web-based Software Development - An introduction.
JDBC / ODBC JDBC is the java API that facilitate interaction of a java application with the DBMS. FIRST APPROACH:
Dale Roberts 8/24/ Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam.
1 Java Database Connection (JDBC) There are many industrial-strength DBMS's commercially available in the market. Oracle, DB2, and Sybase are just a few.
Helena Pomezná, ciz034 St. skupina: L392 FEI, VŠB-TUO Ak. rok. 2002/2003 Download:
© Wang Bin 2004 JDBC ----Java Database Connectivity.
Lecture On Database Analysis and Design By- Jesmin Akhter Lecturer, IIT, Jahangirnagar University.
1 © Prentice Hall, 2002 Chapter 8: The Client/Server Database Environment Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
MBA 664 Database Management Systems Dave Salisbury ( )
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
Fundamentals of Database Chapter 7 Database Technologies.
© 2005 by Prentice Hall 1 Chapter 9: The Client/Server Database Environment Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
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,
Java Programming The Language of Now & the Future Clients and Servers including Internet connectivity, I/O and JDBC John Morris and Peter Jones Department.
Connecting to Oracle using Java November 4, 2009 David Goldschmidt, Ph.D. David Goldschmidt, Ph.D.
14 - Client/ServerCSC4071 Systems Architecture Client-Server Systems.
JDBC  The JDBC (Java Database Connectivity) API helps a Java program to access a database in a standard way  JDBC is a specification that tells the.
Mainframe (Host) - Communications - User Interface - Business Logic - DBMS - Operating System - Storage (DB Files) Terminal (Display/Keyboard) Terminal.
SEMINOR. INTRODUCTION 1. Middleware is connectivity software that provides a mechanism for processes to interact with other processes running on multiple.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Accessing Database using JDBC. JDBC Objectives Gain basic knowledge of Java JDBC Become familiar with the basics of interacting with a database using.
ECE450 Winter 2003 Systems Architecture: Client-Server Systems “A human being should be able to change a diaper, plan an invasion, butcher a hog, conn.
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.
JDBC CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
Session 30 Basics of JDBC. Java Simplified / Session 30 / 2 of 33 Review A Swing menu consists of a menubar, menuitems and menus. Trees are used to depict.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Copyright © Curt Hill Connectivity Communicating with the Database.
Java and Databases. JDBC Architecture Java Application JDBC API Data Base Drivers AccessSQL Server DB2InformixMySQLSybase.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Basics of JDBC Session 14.
JDBC - Java Database Connectivity. JDBC provides Java applications with access to most database systems via SQL The architecture and API closely resemble.
In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.
Web-based Software Development - An introduction
Interacting with Database
Chapter 9: The Client/Server Database Environment
Course Outcomes of Advanced Java Programming AJP (17625, C603)
ODBC, OCCI and JDBC overview
JDBC Database Management Database connectivity
The Client/Server Database Environment
The Client/Server Database Environment
JDBC – Java DataBase Connectivity
JDBC – Java DataBase Connectivity
JDBC 15-Nov-18.
Interacting with Database
Java Database Connectivity
ODBC and JDBC.
Java API for Database Connectivity
Client-Server Systems
Presentation transcript:

14 - Client/ServerCSC4071 Systems Architecture Client-Server Systems

14 - Client/ServerCSC4072 Client/Server In general, any application where multiple clients connect to a single server. client1client2client3 server one client program (most typical) or multiple client programs

14 - Client/ServerCSC4073 Relational Databases Most common client/server program is where the server is a relational database server. –warning: some use the term client/server to refer to this usage exclusively (we won’t). RDBMS client1client2client3

14 - Client/ServerCSC4074 Relation Database Implementation disks client1client2client3 RDBMS Server

14 - Client/ServerCSC4075 IPC “Inter-Process Communications” –How processes will communicate and synchronize with one- another. –communications mechanisms: shared memory –very fast –can’t use over a network »well, you can message passing –can use over a network –slower »well, not always –will consider only message passing (most important)

14 - Client/ServerCSC4076 IPC Protocols Basic message-passing mechanisms provide for a byte- stream only. Must implement various protocols on top of this –sockets –RPC (remote procedure call) –DO (distributed objects)

14 - Client/ServerCSC4077 Sockets code example public class Server { public static void main(String[] args) throws Exception { ServerSocket server = new ServerSocket(1234); Socket client = server.accept(); BufferedReader fromClient = new BufferedReader( new InputStreamReader(client.getInputStream())); System.out.println(fromClient.readLine()); } public class Client { public static void main(String[] args) throws Exception { Socket server = new Socket(“penny", 1234); DataOutputStream toServer = new DataOutputStream( server.getOutputStream()); toServer.writeBytes("hello server"); server.close(); }

14 - Client/ServerCSC4078 Performance Latency –The time to go back and forth Bandwidth –The amount of data that can be sent Analogy from ocean lines –Bandwidth of QE2 is high (can carry a lot) –Latency is bad (takes a long time for a round trip).

14 - Client/ServerCSC4079 Test System Windows 2000 Java Server –Network 100 Mbit/s ethernet –CPU dual 1GHz processors –Memory 1 GByte Windows 98 Java Client –Network 100 Mbit/s ethernet –CPU 366 MHz –Memory 96 MByte

14 - Client/ServerCSC40710 Java/Windows Performance Measures Latency: Sending “hello server\r\n” back and forth –Local method calls.13 usec/2call –Socket on local machine 70 usec / 2call (x500) –Socket on remote machine 320,000 usec /2call (x5,000, x2,500,000) Bandwidth –Sending “hello server\r\n” to server repeatedly 1400 usec / 2call (x10,000, x230)

14 - Client/ServerCSC40711 Performance In ProcessNetwork Latency 1 2,500,000 Bandwidth 1 10,000

14 - Client/ServerCSC40712 C/Windows Performance Measures Latency: Sending “hello server\r\n” back and forth –Local method calls.01 usec/2call (10x Java) –Socket on local machine 12 usec / 2call (6x Java) –Socket on remote machine 840 usec /2call (380x Java)

14 - Client/ServerCSC40713 Performance In ProcessNetwork Latency 1 84,000

14 - Client/ServerCSC40714 Performance Implications Do as few calls as possible over the net Prefer asynchronous approaches –problem: success/failure indications –send lots of stuff, then synchronize Use bigger transactions Prefer one call with lots of data to many calls with the same amount of data –but not by much Send as little data as possible

14 - Client/ServerCSC40715 Relational Databases Most common type of client/server software is where the server is an RDBMS server: Oracle SQLserver Sybase Informix

14 - Client/ServerCSC40716 Relational Databases Stores data into tables order orderidorderdatecustid 239Nov Nov orderitems orderiditemidquantity customer custidcustnamecredit 2394Fredok 3903Susanok 3453Mandybad items itemiditemnameonhand 12bread sugar345 42beer2134

14 - Client/ServerCSC40717 Database Access Access using SQL (Standard Query Language) –select itemname,quantity from –orderitems,items where –orderid = 239 »and –orderitems.itemid = items.itemid query result itemnamequantity bread2142 sugar345 “stored procedure” if this is parameterized and the whole thing is named

14 - Client/ServerCSC40718 Programmatic Database Access Can access database by –typing commands at an sql command prompt –by running a GUI tool –programmatically ODBC –Open Database Connectivity – Microsoft standard API –ANSI/ISO CLI is ODBC level1 compliant (Call Level Interface) »(see also DAO, OLE DB and ADO) JDBC –very similar to ODBC Various embedded SQL hacks

14 - Client/ServerCSC40719 JDBC All sorts of possible configurations of client-side & server- side drivers RDBMS server JDBC ODBC App

14 - Client/ServerCSC40720 Database Access from Java import java.sql.*; public class Main { private static final query = “select itemname,quantity “ + “from orderitems,items “ + “where orderid=1 and orderitems.itemid=items.itemid”; public static void main(String[] args) throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection c = DriverManager.getConnection("jdbc:odbc:grocery"); Statement s = c.createStatement(); if( s.execute(query) ) { ResultSet r = s.getResultSet(); printResults(r); } private static void printResults(ResultSet r) throws Exception { final int nC = printHeadings(r); printRows(nC, r); } … }

14 - Client/ServerCSC40721 Database Access from Java private static int printHeadings(ResultSet r) throws Exception { ResultSetMetaData m = r.getMetaData(); final int nC = m.getColumnCount(); for(int c = 1; c <= nC; c++) { System.out.print(m.getColumnName(c)); System.out.print("\t"); } System.out.println(); return nC; }

14 - Client/ServerCSC40722 Database Access from Java private static void printRows(int nC, ResultSet r) throws Exception { while( r.next() ) { for(int c = 1; c <= nC; c++) { System.out.print(r.getString(c)); System.out.print("\t"); } System.out.println(); }

14 - Client/ServerCSC40723 Without ODBC Class.forName( “org.gjt.mm.mysql.Driver“ ); Connection c = DriverManager.getConnection( "jdbc:mysql://penny.dhcp.cs.toronto.edu/grocery” );

14 - Client/ServerCSC40724 Performance localhost –JDBC:ODBC 850 us/query –JDBC:MYSQL 500 us/query over network –JDBC:ODBC 3,800 us/query –JDBC:MYSQL 1,600 us/query local Java method call –0.13 us/query C socket over network 840 us/query