15
November 17, 2016 Sam Siewert CS317 File and Database Systems Lecture 14 – Network Client Access to DBMS http://dilbert.com/strips/comic/2010-01-18/

CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

November 17, 2016 Sam Siewert

CS317 File and Database Systems

Lecture 14 – Network Client Access to DBMS

http://dilbert.com/strips/comic/2010-01-18/

Page 2: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Reminders PLEASE FILL OUT COURSE EVALUATIONS ON CANVAS [5 points bonus on Assignment #6] Assignment #6, DBMS Project of Your Interest – POSTED – Work with your Chosen Team – Self-Directed – Autonomy, Mastery, Purpose and Life-long

Learning and Requires Some Research on Your Part

Exam #2 Completes Material – Week 15, 12/5, 12/7 Assignment #6 Assessed with Final Grading

Sam Siewert 2

Page 3: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Interdisciplinary Nature of DBMS

Sam Siewert 3

DBMS

File Systems

Operating Systems

Programming Languages (SQL, OOP)

Security

Networking (Clusters, DR, Client/Server)

Storage (SAN, NAS, DAS)

Big

Data

Analytics

?

CS332 – “R”

CS332 – C++ & Java Final Lecture – Week 14 SE300/310 – OOA/OOD/OOP

MySQL Connectors C/C++, Java, …

Page 4: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

MYSQL CONNECTORS Application Network Connection to DBMS

Sam Siewert 4

Page 5: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Overview – App Connectors For MySQL (other DBMS) – Vendor DB Connectors

Sam Siewert 5

1. MS Visual Studio – ActiveX Data Objects 2. Open DB Connector (Driver) 3. JDBC, Java API to DBC 4. Python API to DBC 5. C++ API to DBC 6. C API to DBC 7. C MySQL Client (Cmd/Data Transport)

Page 6: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Connection Methods Driver – ODBC (Open Database Connector – Wider Range of RDBMS’s) – Send SQL Commands to a Driver (open, write, read, close) – SQL Table Data (Rows, Columns) Returned – Like any Driver, Accessible from any Programming Language

(Just Like Opening a File from Any PL) – Driver Marshalls Data To and From SQL Server and DB

Language Specific API – API Written in Language (E.g. C) Provides Connection,

Command Interface and Data Marshalling – Essentially Your Application Replaces SQL Client as an App

Specific Client

Sam Siewert 6

Page 7: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

DB Connector Driver Connector from PL API SQL Commands and Data Marshalled over Network by the DB Connector Driver (Presentation/Session)

Sam Siewert 7

ODBC Session

ODBC Presentation

Application

Transport

Network

Link

Physical

Internet

ODBC Session

ODBC Presentation

DBMS

Transport

Network

Link

Physical

IP Router/Switch

L5

L6

L7

L4

L3

L2

L1

Page 8: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

DB Client API API for Command and Data Transport from PL API Send SQL Command as a Message over TCP/IP Table Data Returned in Messages (Marshalled)

Sam Siewert 8

Sockets API

Conn: SQL Cmd, Data

Application

TCP

IP

IEEE 802.3z - GigE

Radio Transmission

Internet

Sockets API

Conn: SQL Cmd, Data

DBMS

TCP

IP

802.11abgn - Wireless

Cat-6 UTP

IP Router/Switch

L5

L6

L7

L4

L3

L2

L1

Page 9: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Recall Simplest MySQL Default SELECT for “Hello World” at Interactive Command Prompt – Remote Version?

Sam Siewert 9

Page 10: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Remote SQL Query Marshall the Query [and/or Data] Over to MySQL Server Daemon Acts as Network Service for an Client Write Client in Some Procedural Programming Language Send the SQL over Transport Layer to Server Listening on Socket Port and IP Address, Results Returned on Virtual Connection, Connection Dropped Requires Client Code Library and Methods

Sam Siewert 10

Page 11: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Building MySQL C Connector

C API Client Manual Pages See my example – conntest.c Can Run on localhost or over Network to Socket on IP Address Simple mysql> prompt written with C connector Sam Siewert 11

http://www.kitebird.com/mysql-book/

Page 12: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Example Run - Equivalent

Sam Siewert 12

Page 13: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Connector Use Example Specify host, user and password prompt for PRClab use

Sam Siewert 13

% ./conntest -h localhost -p -u siewerts Enter password: SELECT statement succeeded SELECT statement succeeded information_schema BottAK DHv1_3 G1_InterviewAttire G2_Pokedex G3_DisneyMoviesOnDemand G4_GolfStat G4_WorkoutLog G5_EGR101Scoring G5_MissionPossible G#6_Mantrist PizzaDelievery botteDHV1 botteDHV2 … testing 113 rows returned %

Page 14: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Take-Away DBMS + Logical DB Design is Part of The Story The Other Part are the GUIs, Applications, Web Pages, and Mobile Applications that Access the Logical DB on a DBMS Server or Cluster Most “Users” Don’t Want to Write SQL They Don’t Even Want to Issue Stored Queries (Views) They Want Data from a GUI, Web Page, App with Data

Sam Siewert 14

Page 15: CS317 File and Database Systemsmercury.pr.erau.edu/~siewerts/cs317/documents/Lectures/... · 2016-11-29 · Send SQL Command as a Message over TCP/IP Table Data Returned in Messages

Summary Along with Connectors for Applications, This Completes CS317 Material Exam #2 Final Oral Exam on Dec 5th, 8AM Material We Ran Out of Time to Cover – Distributed DBMS and Scaling – Comprehensive Final Review (Final Oral Exam Instead)

Sam Siewert 15