Options. Real SQL Programming 1. Stored Procedures. Embedded SQL
|
|
- Estella Anastasia O’Brien’
- 6 years ago
- Views:
Transcription
1 Real 1 Options We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional programs using SQL to interact with a database. There are 3 ways in which programs are combined with SQL: 1. Code in a specialized language is stored in the database itself (e.g., PSM, PL/SQL). 2. SQL statements are embedded in a host language (e.g., C, Java). 3. Connection tools are used to allow a conventional language to access a database (e.g., CLI, JDBC, /PDO). 1 These slides have been adapted from those used by Jeff Ullman. The first method is often called stored procedures : PSM, or persistent stored modules, allows us to store procedures as database schema elements. PSM = a mixture of conventional statements (if, while, etc.) and SQL. Lets us do things we cannot do in SQL alone. We can CREATE PROCEDUREs, e.g., and then CALL them from within SQL queries. The second method uses embedded SQL: Key idea: A preprocessor turns SQL statements into procedure calls that fit with the surrounding host-language code. All embedded SQL statements begin with EXEC SQL, so the preprocessor can find them easily.
2 Shared Variables Use of Shared Variables To connect SQL and the host-language program, the two parts must share some variables. Declarations of shared variables are bracketed by: EXEC SQL BEGIN DECLARE SECTION; <host-language declarations> EXEC SQL END DECLARE SECTION; In SQL, the shared variables must be preceded by a colon. They may be used as constants provided by the host-language program. They may get values from SQL statements and pass those values to the host-language program. In the host language, shared variables behave like any other variable. Example: Looking Up Prices Example: C Plus SQL We will use C with embedded SQL to sketch the important parts of a function that obtains a beer and a bar, and looks up the price of that beer at that bar. Assumes the database contains the Sells(bar, beer, price) relation. EXEC SQL BEGIN DECLARE SECTION; char thebar[21], thebeer[21]; float theprice; EXEC SQL END DECLARE SECTION; /* obtain values for thebar and thebeer */ EXEC SQL SELECT price INTO :theprice FROM Sells WHERE bar = :thebar AND beer = :thebeer; /* do something with theprice */
3 Need for Dynamic SQL Dynamic SQL Most applications use specific queries and modification statements to interact with the database. The preprocessor compiles EXEC SQL... statements into specific procedure calls and produces an ordinary host-language program that uses a library. What about situations in which query statements themselves are assembled by the host language, perhaps using user input? This gives rise to dynamic SQL. Usually consists of two steps (SQL statements): 1. Preparing a query: EXEC SQL PREPARE <query-name> FROM <text of the query>; 2. Executing a query: EXEC SQL EXECUTE <query-name>; Prepare = optimize query. Prepare once, execute many times. If we are only going to execute the query once, we can combine the PREPARE and EXECUTE steps into one, using: EXEC SQL EXECUTE IMMEDIATE <text>; Host/SQL Interfaces Via Libraries Three-Tier Architecture for Web Access The third approach to connecting databases to conventional languages is to use library calls. C + CLI Java + JDBC + PDO We will only consider + PDO. A common environment for using a database over the Web has three tiers of processors: 1. Web servers talk to the user. 2. Application servers execute the business logic. 3. servers get what the application servers need from the database.
4 Example: Amazon SQL/CLI holds the information about products, customers, etc. Business logic includes things like what do I do after someone clicks checkout? Answer: Show the how will you pay for this? screen. Instead of using a preprocessor (as in embedded SQL), we can use a library of functions. The library for C is called SQL/CLI = Call-Level Interface. s preprocessor will translate the EXEC SQL... statements into CLI or similar calls, anyway. : Hypertext Preprocessor () is an open-source, server-side scripting language It is interpreted, so no possibility of using EXEC SQL and a preprocessor. Can be embedded within HTML on a web page in order to generate dynamic content. uses <?php and?> delimiters for code. delimiters differentiate the code from static HTML. DB library is called PDO ( Data Objects). Variables (which must start with $) don t have to be declared and are not strongly typed. web server needs to have installed. Making a Connection Example: <?php $dbhost = mysql:host=mysqlsrv.dcs.bbk.ac.uk; dbname= ; $dbuser = ; $dbpass = ; $db = new PDO($dbhost, $dbuser, $dbpass);?> We want to connect to a mysql server, and need to give the name of the machine it runs on. We need to specify the database name (dbname). The user name and password are also required. PDO object allows us to open a connection to the database specified by the values of the variables.
5 Executing an SQL Statement Example: <?php $db = new PDO($dbhost, $dbuser, $dbpass); $result = $db->query( "select count(*) from Drinkers");?> The query method applies to a connection object. It takes a string argument and returns a result. Could be an error code or the relation returned by the query. Retrieving a Query Result Example: $count = $result->fetchcolumn(0); print ("There are $count rows in Drinkers."); The result of a query is the set of rows returned. In our example, only one row is returned, with one column (the count). Method fetchcolumn applies to the result, and fetchcolumn(0) returns the value of the first column. This can then be output using the print function. This output is returned by the web server to the browser which requested the page. String Values solves a problem for languages that commonly construct strings as values: How do I tell whether a substring needs to be interpreted as a variable and replaced by its value? solution: Double quotes means replace; single quotes means don t. Example: $100 = "one hundred dollars"; $sue = You owe me $100. ; $joe = "You owe me $100."; Value of $sue is You owe me $100. Value of $joe is You owe me one hundred dollars. Complete Example <html> <body> <h2>counting the number of drinkers</h2> <p> <?php $dbhost = mysql:host=mysqlsrv.dcs.bbk.ac.uk;dbname= ; $dbuser = ; $dbpass = ; $db = new PDO($dbhost, $dbuser, $dbpass); $result = $db->query("select count(*) from Drinkers"); $count = $result->fetchcolumn(0); print ("There are $count rows in Drinkers.");?> </p> </body> </html>
6 Example Explained Processing a Set of Rows (1) Notice that the code is embedded in HTML. Whatever is output by the script (using print will be embedded in the HTML in place of the script source code. The file is accessible as ac.uk/~ptw/teaching/dbm/php/db1.php. Creating a link to this URL, or entering it as an address into a browser will result in the DCS web server executing the code. Say the query in our program is: $result = $db->query( "select * from Drinkers"); This returns a number of rows, so we use a while loop. We want to output the rows as an HTML table. So we need to output HTML table tags <table> and </table> before and after the script. Each time around the while loop, we output HTML row tags <tr> and </tr>. We also need an inner (for) loop to output each column value, inside HTML <td> and </td> tags. Processing a Set of Rows (2) while ($row = $result->fetch()) { print ("<tr>"); for ($i = 0; $i < $result->columncount(); $i++) { print ("<td> $row[$i] </td>"); } print ("</tr>"); } fetch() method fetches the next row as an array. columncount() returns the number of columns. $row[$i] is the value of the i th column of the current row. The file is accessible as ac.uk/~ptw/teaching/dbm/php/db2.php. Processing a Set of Rows (3) The HTML generated by the script is as follows: <html> <body> <h1>the Drinkers Table</h1> <table border= 2 > <tr><td> Alice </td><td> Islington </td></tr> <tr><td> Bob </td><td> Bloomsbury </td></tr> <tr><td> Carol </td><td> Islington </td></tr> <tr><td> Dave </td><td> Bloomsbury </td></tr> <tr><td> Eve </td><td> Stratford </td></tr> </table> </body> </html>
7 Arrays Associative Arrays Two kinds: numeric and associative. Numeric arrays are ordinary, indexed 0, 1,... Example: $a = array("paul", "George", "John", "Ringo"); Then $a[0] is "Paul", $a[1] is "George", and so on. Elements of an associative array $a are pairs x => y, where x is a key string and y is any value. If x => y is an element of $a, then $a[x] is y. uses associative arrays for retrieving the data that users enter into HTML forms. Retrieving User Input An HTML Form Let s say we want to allow users to enter the name of the database table whose contents they wish to be displayed. We can use an HTML form, with a field (text box) where they can enter the table name. The value they enter must be sent to the web server along with the request to run a script. The script must be able to retrieve this value and use it as part of an SQL query. The HTML form is available at ac.uk/~ptw/teaching/dbm/php/db.html and the source code used on it is explained on the following slides.
8 HTML Form Explained <form action="db3.php" method="get"> Table: <input type="text" name="tablename" /> <input type="submit" /> </form> The form element has an action attribute which specifies the URL of the script (db3.php) to be run. The form element has a method attribute which specifies that the HTTP GET method is to be used. This will send the user s input appended to the URL of the script and separated by a? (a so-called query string ). The form has two input elements, one representing a text box; the other a submit button. The name of the text box is tablename. Processing User Input $table = $_GET[ tablename ]; print ("<h1>the $table Table</h1>"); $query = "select * from $table"; $result = $db->query($query); The rest of the script is as before. $_GET is a built-in associative array, indexed by the names of the text boxes used on the form. Each value is whatever the user typed into the corresponding text box. If the user typed Pubs (without the quotes) into the text box named tablename on the form, then $_GET[ tablename ] will be replaced by Pubs (without the quotes). Using Prepared Statements Placeholders in SQL Statements The query method executes an SQL statement immediately. PDO can also prepare and execute statements separately. Prepared statements have some advantages: Statement strings can contain placeholders rather than literal data values (see next slide). A prepared statement can be executed repeatedly without the need for the DBMS to work out an execution plan each time. Where users are expected to provide values for SQL statements at run-time, placeholders can be used. Anonymous placeholders are indicated by? characters in the SQL query string. The program then associates values with these by providing an array of values. Named placeholders are indicated by a name preceded by a colon, e.g., :location. Values are associated with named placeholders by using either an associative array or the bindparam method.
9 Anonymous Placeholders $query = "select price from Sells where pub=? and beer=?"; $stmt = $db->prepare($query); $pub = $_GET[ pub ]; $beer = $_GET[ beer ]; $stmt->execute(array($pub, $beer)); $row = $stmt->fetch(); print ("<h2>the $pub sells $beer for $row[0]</h2>"); Query finds the price of a given beer sold by a given pub ( script db4.php). The text boxes in the form are named pub and beer. The value of $_GET[ pub ] is associated with the first? in the query, while the value of $_GET[ beer ] is associated with the second?. Named Placeholders (1) $query = "insert into Pubs (name, location) values (:name, :location)"; $stmt = $db->prepare($query); $pub = $_GET[ pub ]; $location = $_GET[ location ]; $stmt->bindparam( :name, $pub); $stmt->bindparam( :location, $location); SQL statement inserts a pub name and location into Pubs ( script db5.php). The text boxes in the form are named pub and location. The placeholders are :name and :location. bindparam binds each placeholder (parameter) to a value (from the form). Named Placeholders (2) if ($stmt->execute()) print ("<h2>the $pub in $location inserted</h2>"); else { print ("<h2>failed to insert the $pub in $location</h2>"); print_r($stmt->errorinfo()); } execute returns a Boolean, indicating success or failure. errinfo() returns an array of error information. print_r displays information about a variable in readable form.
Chapter 9 SQL in a server environment
Chapter 9 SQL in a server environment SQL in a Programming Environment embedded SQL persistent stored modules Database-Connection Libraries Call-level interface (CLI) JDBC PHP Database connection The third
More informationChapter 9 SQL in a server environment
Chapter 9 SQL in a server environment SQL in a Programming Environment embedded SQL persistent stored modules Database-Connection Libraries Call-level interface (CLI) JDBC PHP SQL in Real Programs We have
More informationReal SQL Programming 1
Real SQL Programming 1 SQL in Real Programs We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database Reality is almost always
More informationDatabase-Connection Libraries. Java Database Connectivity PHP
Database-Connection Libraries Call-Level Interface Java Database Connectivity PHP 1 An Aside: SQL Injection SQL queries are often constructed by programs. These queries may take constants from user input.
More informationDatabase-Connection Libraries
Database-Connection Libraries CALL-LEVEL INTERFACE JAVA DATABASE CONNECTIVITY PHP PEAR/DB 1 An Aside: SQL Injection SQL queries are often constructed by programs. These queries may take constants from
More informationReal SQL Programming Persistent Stored Modules (PSM)
Real SQL Programming Persistent Stored Modules (PSM) Ullman-Widom: Adatbázisrendszerek Alapvetés. Második, átdolgozott kiadás, Panem, 2009 9.3. Az SQL és a befogadó nyelv közötti felület (sormutatók, cursors)
More informationSchedule. Feb. 12 (T) Advising Day. No class. Reminder: Midterm is Feb. 14 (TH) Today: Feb. 7 (TH) Feb. 21 (TH) Feb. 19 (T)
Schedule Today: Feb. 7 (TH) PL/SQL, Embedded SQL, CLI, JDBC. Read Sections 8.1, 8.3-8.5. Feb. 12 (T) Advising Day. No class. Reminder: Midterm is Feb. 14 (TH) Covers material through Feb. 7 (TH) lecture
More informationSQL in Programming Languages Read chapter 5 of Atzeni et al. BD: Modelli e Linguaggi di Interrogazione and section 8.
SQL in Programming Languages Read chapter 5 of Atzeni et al. BD: Modelli e Linguaggi di Interrogazione and section 8.4 of Garcia-Molina Slides derived from those by Jeffrey D. Ullman SQL and Programming
More informationDatabases 1. SQL/PSM and Oracle PL/SQL
Databases 1 SQL/PSM and Oracle PL/SQL SQL DDL (Data Definition Language) Defining a Database Schema Primary Keys, Foreign Keys Local and Global Constraints Defining Views Triggers 2 SQL DML (Database Modifications)
More informationDatabase Management
Database Management - 2013 Model Answers 1. a. A cyclic relationship type (also called recursive) is a relationship type between two occurrences of the same entity type. With each entity type in a cyclic
More informationuser specifies what is wanted, not how to find it
SQL stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original ANSI SQL updated
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Chapter 10 Outline Database Programming: Techniques and Issues Embedded SQL, Dynamic SQL, and SQLJ Database Programming with Function Calls: SQL/CLI and JDBC Database Stored Procedures and SQL/PSM Comparing
More informationChapter 11 Outline. A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming. Slide 11-2
Chapter 11 Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming Slide 11-2 1 Web Database Programming Using PHP Techniques for programming dynamic features
More informationCSCD43: Database Systems Technology. Lecture 4
CSCD43: Database Systems Technology Lecture 4 Wael Aboulsaadat Acknowledgment: these slides are based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. Steps in Database
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Chapter 11 Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming Slide 11-2 Web Database Programming Using PHP Techniques for programming dynamic features
More informationChapter 13 Introduction to SQL Programming Techniques
Chapter 13 Introduction to SQL Programming Techniques Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Outline Database Programming: Techniques and Issues Embedded
More informationAssign expressions to declared variables with :=. END IF; EXIT WHEN éconditioné END LOOP;
Assignment Assign expressions to declared variables with :=. Branches IF éconditioné THEN éstatementèsèé ELSE éstatementèsèé END IF; But in nests, use ELSIF in place of ELSE IF. Loops LOOP... EXIT WHEN
More informationOutline. CS 235: Introduction to Databases. DB Application Programming. Interface Solutions. Basic PSM Form. Persistent Stored Modules
Outline CS 235: Introduction to Databases Svetlozar Nestorov Database application programming SQL limitations SQL Persistent, Stored Modules (PSM) Extension of SQL PL/SQL: Oracle s version of PSM Lecture
More informationNon-interactive SQL. EECS Introduction to Database Management Systems
Non-interactive SQL EECS3421 - Introduction to Database Management Systems Using a Database Interactive SQL: Statements typed in from terminal; DBMS outputs to screen. Interactive SQL is inadequate in
More informationEMBEDDED SQL. SE 3DB3 Fall 2016 MICHAEL LIUT DEPARTMENT OF COMPUTING AND SOFTWARE MCMASTER UNIVERSITY
EMBEDDED SQL MICHAEL LIUT (LIUTM@MCMASTER.CA) DEPARTMENT OF COMPUTING AND SOFTWARE MCMASTER UNIVERSITY SE 3DB3 Fall 2016 (Slides adapted from Dr. Fei Chiang, Diane Horton, examples from J. Ullman, J. Widom)
More informationITCS Implementation. Jing Yang 2010 Fall. Class 14: Introduction to SQL Programming Techniques (Ch13) Outline
ITCS 3160 Data Base Design and Implementation Jing Yang 2010 Fall Class 14: Introduction to SQL Programming Techniques (Ch13) Outline Database Programming: Techniques and Issues Three approaches: Embedded
More informationThe data structures of the relational model Attributes and domains Relation schemas and database schemas
The data structures of the relational model Attributes and domains Relation schemas and database schemas databases First normal form (1NF) Running Example Pubs-Drinkers-DB: Pubs (name, location) Drinkers
More informationChapters 10 & 11 PHP AND MYSQL
Chapters 10 & 11 PHP AND MYSQL Getting Started The database for a Web app would be created before accessing it from the web. Complete the design and create the tables independently. Use phpmyadmin, for
More informationPL/SQL, Embedded SQL. Lecture #14 Autumn, Fall, 2001, LRX
PL/SQL, Embedded SQL Lecture #14 Autumn, 2001 Fa, 2001, LRX #14 PL/SQL,Embedded SQL HUST,Wuhan,China 402 PL/SQL Found ony in the Orace SQL processor (sqpus). A compromise between competey procedura programming
More informationEmbedded SQL. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018
Embedded SQL csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 Problems with using interactive SQL Standard SQL is not Turing-complete. E.g., Two profs
More informationEmbedded SQL. csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014
Embedded SQL csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014 Problems with using interactive SQL Standard SQL is not Turing-complete. E.g., Two profs are colleagues
More informationWEB SECURITY: WEB BACKGROUND
WEB SECURITY: WEB BACKGROUND CMSC 414 FEB 20 2018 A very basic web architecture Client Server Browser Web server (Private) Data Database DB is a separate entity, logically (and often physically) A very
More informationSQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas
SQL SQL Functionality stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original
More informationSQL DATA DEFINITION LANGUAGE
9/27/16 DATABASE SCHEMAS IN SQL SQL DATA DEFINITION LANGUAGE SQL is primarily a query language, for getting information from a database. SFWR ENG 3DB3 FALL 2016 But SQL also includes a data-definition
More informationDatabase Applications. SQL/PSM Embedded SQL JDBC
Database Applications SQL/PSM Embedded SQL JDBC 1 Course Objectives Design Construction Applications Usage 2 Course Objectives Interfacing When the course is through, you should Know how to connect to
More informationRunning Example Tables name location
Running Example Pubs-Drinkers-DB: The data structures of the relational model Attributes and domains Relation schemas and database schemas databases Pubs (name, location) Drinkers (name, location) Sells
More informationJDBC, Transactions. Niklas Fors JDBC 1 / 38
JDBC, Transactions SQL in Programs Embedded SQL and Dynamic SQL JDBC Drivers, Connections, Statements, Prepared Statements Updates, Queries, Result Sets Transactions Niklas Fors (niklas.fors@cs.lth.se)
More informationDatabases-1 Lecture-01. Introduction, Relational Algebra
Databases-1 Lecture-01 Introduction, Relational Algebra Information, 2018 Spring About me: Hajas Csilla, Mathematician, PhD, Senior lecturer, Dept. of Information Systems, Eötvös Loránd University of Budapest
More informationDATABASE DESIGN - 1DL400
DATABASE DESIGN - 1DL400 Fall 2015 A course on modern database systems http://www.it.uu.se/research/group/udbl/kurser/dbii_ht15 Kjell Orsborn Uppsala Database Laboratory Department of Information Technology,
More informationSystems Programming & Scripting
Systems Programming & Scripting Lecture 19: Database Support Sys Prog & Scripting - HW Univ 1 Typical Structure of a Web Application Client Internet Web Server Application Server Database Server Third
More informationCERTIFICATE IN WEB PROGRAMMING
COURSE DURATION: 6 MONTHS CONTENTS : CERTIFICATE IN WEB PROGRAMMING 1. PROGRAMMING IN C and C++ Language 2. HTML/CSS and JavaScript 3. PHP and MySQL 4. Project on Development of Web Application 1. PROGRAMMING
More informationSQL DATA DEFINITION LANGUAGE
SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)
More informationPHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed:
PHP Reference 1 Preface This tutorial is designed to teach you all the PHP commands and constructs you need to complete your PHP project assignment. It is assumed that you have never programmed in PHP
More informationAdvanced Web Technology 10) XSS, CSRF and SQL Injection
Berner Fachhochschule, Technik und Informatik Advanced Web Technology 10) XSS, CSRF and SQL Injection Dr. E. Benoist Fall Semester 2010/2011 1 Table of Contents Cross Site Request Forgery - CSRF Presentation
More informationI n p u t. This time. Security. Software. sanitization ); drop table slides. Continuing with. Getting insane with. New attacks and countermeasures:
This time Continuing with Software Security Getting insane with I n p u t sanitization ); drop table slides New attacks and countermeasures: SQL injection Background on web architectures A very basic web
More informationTOPIC 2 INTRODUCTION TO JAVA AND DR JAVA
1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationCSCE 548 Building Secure Software SQL Injection Attack
CSCE 548 Building Secure Software SQL Injection Attack Professor Lisa Luo Spring 2018 Previous class DirtyCOW is a special type of race condition problem It is related to memory mapping We learned how
More informationDistributed Databases and Remote Access to a Database
Distributed Databases and Remote Access to a Database Table of Contents 1 Distributed Databases... 2 2 Internet (Overview)... 4 3 Internet-Based Applications... 9 3.1 Server-Side Scripting... 9 3.2 Client-Side
More informationSQL: Data Definition Language
SQL: Data Definition Language CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Database Schemas in SQL
More informationCOMP284 Scripting Languages Lecture 13: PHP (Part 5) Handouts
COMP284 Scripting Languages Lecture 13: PHP (Part 5) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationCICS 515 b Internet Programming Week 2. Mike Feeley
CICS 515 b Internet Programming Week 2 Mike Feeley 1 Software infrastructure stuff MySQL and PHP store files in public_html run on remote.mss.icics.ubc.ca access as http://ws.mss.icics.ubc.ca/~username/...
More informationDatabase Systems Fundamentals
Database Systems Fundamentals Using PHP Language Arman Malekzade Amirkabir University of Technology (Tehran Polytechnic) Notice: The class is held under the supervision of Dr.Shiri github.com/arman-malekzade
More informationThis lecture. PHP tags
This lecture Databases I This covers the (absolute) basics of and how to connect to a database using MDB2. (GF Royle 2006-8, N Spadaccini 2008) I 1 / 24 (GF Royle 2006-8, N Spadaccini 2008) I 2 / 24 What
More informationDatabases on the web
Databases on the web The Web Application Stack Network Server You The Web Application Stack Network Server You The Web Application Stack Web Browser Network Server You The Web Application Stack Web Browser
More informationCS Homework 7 p. 1. CS Homework 7. Problem 1 - START THIS A.S.A.P. (in case there are PROBLEMS...)
CS 328 - Homework 7 p. 1 Deadline Due by 11:59 pm on Sunday, March 27, 2016 How to submit CS 328 - Homework 7 Submit your files for this homework using ~st10/328submit on nrs-projects, with a hw number
More informationDatabase Applications
Database Applications Database Programming Application Architecture Objects and Relational Databases John Edgar 2 Users do not usually interact directly with a database via the DBMS The DBMS provides
More informationDatabase and MySQL Temasek Polytechnic
PHP5 Database and MySQL Temasek Polytechnic Database Lightning Fast Intro Database Management Organizing information using computer as the primary storage device Database The place where data are stored
More informationRunning SQL in Java and PHP
Running SQL in Java and PHP FCDB 9.6 9.7 Dr. Chris Mayfield Department of Computer Science James Madison University Mar 01, 2017 Introduction to JDBC JDBC = Java Database Connectivity 1. Connect to the
More informationDatabases PHP I. (GF Royle, N Spadaccini ) PHP I 1 / 24
Databases PHP I (GF Royle, N Spadaccini 2006-2010) PHP I 1 / 24 This lecture This covers the (absolute) basics of PHP and how to connect to a database using MDB2. (GF Royle, N Spadaccini 2006-2010) PHP
More informationLikesèdrinker, beerè. Sellsèbar, beer, priceè. Frequentsèdrinker, barè
Modication to Views Via Triggers Oracle allows us to ëintercept" a modication to a view through an instead-of trigger Example Likesèdrinker, beerè Sellsèbar, beer, priceè Frequentsèdrinker, barè CREATE
More informationConstraints. Local and Global Constraints Triggers
Constraints Foreign Keys Local and Global Constraints Triggers 1 Constraints and Triggers A constraint is a relationship among data elements that the DBMS is required to enforce. Example: key constraints.
More informationWeb Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel
Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later
More informationpysqlw Documentation Release plausibility
pysqlw Documentation Release 1.3.0 plausibility January 26, 2013 CONTENTS 1 Documentation 3 1.1 Usage................................................... 3 1.2 pysqlw wrappers.............................................
More informationWEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang
WEB SECURITY WORKSHOP TEXSAW 2014 Presented by Solomon Boyd and Jiayang Wang Introduction and Background Targets Web Applications Web Pages Databases Goals Steal data Gain access to system Bypass authentication
More informationRunning SQL in Java and PHP
Running SQL in Java and PHP FCDB 9.6 9.7 Dr. Chris Mayfield Department of Computer Science James Madison University Feb 28, 2018 Introduction to JDBC JDBC = Java Database Connectivity 1. Connect to the
More informationSQL DATA DEFINITION LANGUAGE
SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)
More informationM275 - Web Development using PHP and MySQL
Arab Open University Faculty of computer Studies M275 - Web Development using PHP and MySQL Chapter 6 Flow Control Functions in PHP Summary This is a supporting material to chapter 6. This summary will
More informationOverview. Database Application Development. SQL in Application Code. SQL in Application Code (cont.)
Overview Database Application Development Chapter 6 Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic SQL JDBC SQLJ Stored procedures Database Management Systems 3ed
More informationDatabase Application Development
Database Application Development Chapter 6 Database Management Systems 3ed 1 Overview Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic SQL JDBC SQLJ Stored procedures
More informationDatabase Application Development
Database Application Development Chapter 6 Database Management Systems 3ed 1 Overview Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic SQL JDBC SQLJ Stored procedures
More informationThe PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web
Web programming The PHP language Our objective Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web Access data inserted by users into HTML forms Interact
More informationCourse Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 (
Course Title PHP ( Level 1 ( Course Description PHP '' Hypertext Preprocessor" is the most famous server-side programming language in the world. It is used to create a dynamic website and it supports many
More informationIntroduction to SQL SELECT-FROM-WHERE STATEMENTS SUBQUERIES DATABASE SYSTEMS AND CONCEPTS, CSCI 3030U, UOIT, COURSE INSTRUCTOR: JAREK SZLICHTA
Introduction to SQL SELECT-FROM-WHERE STATEMENTS MULTIRELATION QUERIES SUBQUERIES 1 SQL SQL is a standard language for accessing databases. SQL stands for Structured Query Language. SQL lecture s material
More informationPHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase
PHP for PL/SQL Developers Lewis Cunningham JP Morgan Chase 1 What is PHP? PHP is a HTML pre-processor PHP allows you to generate HTML dynamically PHP is a scripting language usable on the web, the server
More informationICOM 5016 Database Systems. Database Users. User Interfaces and Tools. Chapter 8: Application Design and Development.
Chapter 8: Application Design and Development ICOM 5016 Database Systems Web Application Amir H. Chinaei Department of Electrical and Computer Engineering University of Puerto Rico, Mayagüez User Interfaces
More informationCS4604 Prakash Spring 2016! Project 3, HTML and PHP. By Sorour Amiri and Shamimul Hasan April 20 th, 2016
CS4604 Prakash Spring 2016! Project 3, HTML and PHP By Sorour Amiri and Shamimul Hasan April 20 th, 2016 Project 3 Outline 1. A nice web interface to your database. (HTML) 2. Connect to database, issue,
More informationRTL Reference 1. JVM. 2. Lexical Conventions
RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's
More informationDeveloping Online Databases and Serving Biological Research Data
Developing Online Databases and Serving Biological Research Data 1 Last Time HTML Hypertext Markup Language Used to build web pages Static, and can't change the way it presents itself based off of user
More informationWorking with Databases and Java
Working with Databases and Java Pedro Contreras Department of Computer Science Royal Holloway, University of London January 30, 2008 Outline Introduction to relational databases Introduction to Structured
More informationSQL: Programming. Introduction to Databases CompSci 316 Fall 2017
SQL: Programming Introduction to Databases CompSci 316 Fall 2017 2 Announcements (Thu., Oct. 12) Project milestone #1 due tonight Only one member per team needs to submit Remember members.txt Midterm is
More informationPHP by Pearson Education, Inc. All Rights Reserved.
PHP 1992-2012 by Pearson Education, Inc. All Client-side Languages User-agent (web browser) requests a web page JavaScript is executed on PC http request Can affect the Browser and the page itself http
More informationGhislain Fourny. Information Systems for Engineers 7. The ecosystem around SQL
Ghislain Fourny Information Systems for Engineers 7. The ecosystem around SQL How do we use databases? How do we use databases? Simple database installed on a machine (MySQL, PostgreSQL...). User inserts
More informationContents I Introduction 1 Introduction to PL/SQL iii
Contents I Introduction Lesson Objectives I-2 Course Objectives I-3 Human Resources (HR) Schema for This Course I-4 Course Agenda I-5 Class Account Information I-6 Appendixes Used in This Course I-7 PL/SQL
More informationIntroduction to SQL. Select-From-Where Statements Multirelation Queries Subqueries. Slides are reused by the approval of Jeffrey Ullman s
Introduction to SQL Select-From-Where Statements Multirelation Queries Subqueries Slides are reused by the approval of Jeffrey Ullman s 1 Why SQL? SQL is a very-high-level language. Say what to do rather
More informationA tuple is dangling if it doesn't join with any
Outerjoin R./ S = R./Swith dangling tuples padded with nulls and included in the result. A tuple is dangling if it doesn't join with any other tuple. R = A B 1 2 3 4 S = B C 2 5 2 6 7 8 R./ S = A B C 1
More informationSQL: Data Sub Language
SQL: Data Sub Language SQL used with regular Language SQL used to deal with the database Stores/Updates data Retrieves data Regular language deals with other aspects of the program: Makes beautiful web
More informationPHP: Hypertext Preprocessor. A tutorial Introduction
PHP: Hypertext Preprocessor A tutorial Introduction Introduction PHP is a server side scripting language Primarily used for generating dynamic web pages and providing rich web services PHP5 is also evolving
More informationMySQL: Querying and Using Form Data
MySQL: Querying and Using Form Data CISC 282 November 15, 2017 Preparing Data $mysqli >real_escape_string($datavalue); Requires a $mysqli object Functional version mysqli_real_escape_string( ) does not
More informationIntroduction to Computer Science and Business
Introduction to Computer Science and Business The Database Programming with PL/SQL course introduces students to the procedural language used to extend SQL in a programatic manner. This course outline
More informationADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine.
1 PL/SQL INTRODUCTION SQL does not have procedural capabilities. SQL does not provide the programming techniques of condition checking, looping and branching that is required for data before permanent
More informationFrom E/R Diagrams to Relations
From E/R Diagrams to Relations Entity set relation Attributes attributes Relationships relations whose attributes are only: The keys of the connected entity sets Attributes of the relationship itself 1
More informationSchool of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University
School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS351 Database Programming Laboratory Laboratory #2: PHP Objective: - To introduce basic
More informationUsing PHP with MYSQL
Using PHP with MYSQL PHP & MYSQL So far you've learned the theory behind relational databases and worked directly with MySQL through the mysql command-line tool. Now it's time to get your PHP scripts talking
More informationSQL: Programming. Announcements (September 25) Motivation. CPS 116 Introduction to Database Systems. Pros and cons of SQL.
SQL: Programming CPS 116 Introduction to Database Systems Announcements (September 25) 2 Homework #2 due this Thursday Submit to Yi not through Jun s office door Solution available this weekend No class
More informationDatabase Application Development
Database Application Development Linda Wu (CMPT 354 2004-2) Topics SQL in application code Embedded SQL JDBC SQLJ Stored procedures Chapter 6 CMPT 354 2004-2 2 SQL in Application Code SQL commands can
More informationUser Interaction: jquery
User Interaction: jquery Assoc. Professor Donald J. Patterson INF 133 Fall 2012 1 jquery A JavaScript Library Cross-browser Free (beer & speech) It supports manipulating HTML elements (DOM) animations
More informationCS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University
CS 377 Database Systems Database Programming in PHP Li Xiong Department of Mathematics and Computer Science Emory University Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP
More informationA Crash Course in PDO
PDO (PHP Data Objects) provides a vendor-neutral method of accessing a database through PHP. This means that, once you have established a connection to the specific database, the methods used to access
More informationComp 519: Web Programming Autumn 2015
Comp 519: Web Programming Autumn 2015 Advanced SQL and PHP Advanced queries Querying more than one table Searching tables to find information Aliasing tables PHP functions for using query results Using
More informationDevelopment Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.
CIT 736: Internet and Web Development Technologies Lecture 10 Dr. Lupiana, DM FCIM, Institute of Finance Management Semester 1, 2016 Agenda: phpmyadmin MySQLi phpmyadmin Before you can put your data into
More informationCyrus Shahabi Computer Science Department University of Southern California C. Shahabi
Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California shahabi@usc.edu 1 Overview JDBC Package Connecting to databases with JDBC Executing
More informationApplication Programming for Relational Databases
Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California shahabi@usc.edu 1 Overview JDBC Package Connecting to databases with JDBC Executing
More informationFinal-Term Papers Solved MCQS with Reference
Solved MCQ(S) From FinalTerm Papers BY Arslan Jan 14, 2018 V-U For Updated Files Visit Our Site : Www.VirtualUstaad.blogspot.com Updated. Final-Term Papers Solved MCQS with Reference 1. The syntax of PHP
More informationControlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.
Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible
More informationLecture 13: MySQL and PHP. Monday, March 26, 2018
Lecture 13: MySQL and PHP Monday, March 26, 2018 MySQL The Old Way In older versions of PHP, we typically used functions that started with mysql_ that did not belong to a class For example: o o o o mysql_connect()
More information