Introduction to Databases [p.3]

Size: px
Start display at page:

Download "Introduction to Databases [p.3]"

Transcription

1 Object Oriented Programming and Internet Application Development Unit 5 The Back-end in Internet Software Introduction to Databases Relational Databases Designing a Relational Database Manipulating Data in a Relational Database Database Programming in Java Programming Language 05 The Back-end in Internet Software 1 Introduction to Databases [p.3] A database refers to a collection of data structured so that the data can be manipulated with a unified approach. Refer to for details. 05 The Back-end in Internet Software 2 1

2 Problems of Storing Data in Text Files such as.csv file [p.4 to 6] Tight integration of data storage operations and business operations in source code. Lack of reusability of source code. Lack of division of labour people familiar with data manipulation operations may not be familiar with business operations. 3 Three Database Models 1. Hierarchical model Record are linked in a tree format obsolete 2. Network model Records are linked in a graph format 3. Relational model Records (or tuples) are stored in tables Most popular 4 2

3 Hierarchical Database Model [p.7] Records are connected in inverted tree-like structure. Figure 5.1 Company and director records organized in hierarchical way. Cons: some data cannot be organized in hierarchical way All records must start from a dummy root record. Obsolete due to popularity of other database models. 5 Network Database Model [p.7] Records are connected in a graph format. The same record can be referred by more than one record. Figure 5.2 Records stored in the network model for an inventory system. Product records can be referred by invoice records and supplier records. Enables different software applications to use data in their own ways. 6 3

4 Relational Database Model [p.8] Records (or tuples) are stored in a table that is similar to spreadsheet. Each record has the same set of properties. Each record can be uniquely identified by a property value that is key of the table. Figure 5.3 Data stored in the relational model for a course enrolment system Most popular database model. It has commercial and open-source implementations. 7 Relational Database Servers [p.14] Popular relational database servers Relational database servers Commercial database servers Open-source database servers Rationale Needs $ to purchase Most enterprises have high expectations on support, reliability and maintenance Closed-source software Free of charge Clears worry on Trojan horse in closed-source software Open-source Examples Oracle (Oracle, Most popular) DB2 (IBM) MS SQL Server (Microsoft) Sybase (Sybase) MySQL (most popular) Derby (pure Java, installed with NetBeans, used in this course) PostgreSQL SQLite 8 4

5 of Relational Databases Advantages [p.10 to 11] 5 advantages are listed below. For details, pls refer to Study Unit. Control of data redundancy: via database design techniques. Improved data integrity: define constraints on data to prevent from addition of invalid data. Improved security: authentication, authorization Increased concurrency Improved back-up and recovery services 9 of Relational Databases Disadvantages [p.12] Complexity of Relational Database Management System, RDMS (as it has lots of functionalities) makes people need more time to understand it thoroughly. Large size of RDBMS needs more computing power (disk space, CPU and main memory) to run it efficiently. Higher cost : Initial and ongoing software license and server hardware. Hire trained support staff for database administrations. High cost of converting legacy file-base system to databases. Poorer performance when compared legacy file-based system Greater impact on database failure. E.g. failure of bank database 10 5

6 Design a Relational Database Needs techniques such as normalization when designing a relational database. But these techniques need time to master, it is covered in database design course. Cover practical side of database design in this course via Informal approach to data modeling [p.15 to 21] 11 Data Model of a Travel Agency [p.16 to 20] Travel agency maintains 4 worksheets Routes worksheet stores all the routes. Tours worksheet stores all possible tours for a particular route that starts on a particular date. That is, each row specifies one tour that customers can join. Orders worksheet stores the details for particular orders by customers. Customers worksheet stores the list of customers for a particular order. Each worksheet is modeled by a table in relational database. 12 6

7 Database Concepts Database Schema Table Tuple (or record, row) Attribute (or field, column) Primary key Index Foreign key View Stored procedure SQL DDL DML DCL Focus of this course 13 Relationship of Database Concepts One database can have many schemas. One schema can have many tables. One table can have many tuples (or records, rows). Each tuple consists of many attributes (or fields, columns) Database 0..m 0..m 0..m 0..m Schema Table Tuple Attribute 14 7

8 Table 5.5 [p.28] Travel Agency Worksheets Modeled by Tables - I Primary Key (PK) uniquely identifies a record in Routes table. It cannot be NULL. NULL means unknown or unspecified. 15 Travel Agency Worksheets Modeled by Tables - II Table 5.5 [p.28] 16 8

9 Using Java DB (Derby Database) Refer to : (Optional) Configuring the Database (Optional) Registering the Database in NetBeans IDE Starting the Server and Creating a Database Connecting to the Database Creating Tables Adding Table Data Deleting Tables Using an External SQL Script (i.e. via a SQL file) (Optional) Recreating Tables from a Different Database 17 Start Derby Database Server Select Services tab Right-click Java DB under Databases Click Start Server How to stop a started server? Answer in this slide. 18 9

10 Create a New Database - I Select Services tab Right-click Java DB under Databases Click Create Database 19 Create a New Database - II In Create Java DB Database pop-up screen, type travelagent as Database Name dbuser as User Name dbpassword as Password and Confirm Password Stores travelagent as a folder under this Database Location. It is useful when you cannot delete this database

11 Connect to an Existing Database, travelagent Right-click jdbc:derby://localhost:1527/travelagent[dbuser on DBUSER] Click Connect. How to disconnect the database? dbuser is user name. If there is NO user name, this will be empty. DBUSER is schema. 21 Structured Query Language (SQL) [p.37] SQL is a programming language designed to manipulate data in a Relational Database Management System (RDBMS). Refer to SQL is case insensitive E.g. insert into is regarded the same as INSERT INTO Every RDBMS has a similar SQL as it needs to conform SQL standard such as SQL-92, SQL:

12 Sub-types of SQL DDL (Data Definition Language) E.g. create table, create index, alter table DML (Data Manipulation Language) E.g. Select, Insert, Update, Delete Select statement examples select * from tablea where column1 = XXX ; select tablea.columna1, tableb.columnb1 from tablea, tableb where. DCL (Data Control Language) e.g. Grant, revoke Focus of this course 23 Check Location of Java DB Installation and your Database Right-click JavaDB in Services tab page Select Properties 24 12

13 Create a Table, routes via a SQL file - I Right-click a package in NetBeans project Select SQL file under New Other Categories, click Next 25 Create a Table, routes via a SQL file - II Type create_table_routes to save a create_table_routes.sql Click Finish No need to add.sql as it will be appended to create_table_routes 26 13

14 Right-click APP Create a Table, routes via a SQL file - III Select Set as Default Schema as default schema 27 Create a Table, routes via a SQL file - IV 1. Select jdbc:derby://localhost:1527/travelagent[dbuser on DBUSER] in Connection 1. Select the 2. Type SQL, and connection in the drop-down list. 3. click Run SQL icon 2. Type SQL 3. Click Run SQL icon 28 14

15 Create a Table, routes via a SQL file - V Click + on the left-hand-side of APP, Tables, Routes Examine table structure of routes Left-hand-side icon: Red: primary key Green: index field Blue: field 29 DDL for Travel Agency - I CREATE TABLE Routes ( ) Route_number VARCHAR(10) NOT NULL PRIMARY KEY, Route_Name VARCHAR(30) NOT NULL, Route_Description LONG VARCHAR CREATE TABLE Tours ( ) Route_number VARCHAR(10) NOT NULL, Start_date DATE NOT NULL, Return_date DATE, Tea_gathering_date TIMESTAMP, PRIMARY KEY (Route_number, Start_date) Primary key has only 1 column for this DDL. Primary key has more than 1 columns for this DDL

16 DDL for Travel Agency - II Run this DDL to create table Orders under APP schema CREATE TABLE Orders ( Order_number VARCHAR(12) NOT NULL PRIMARY KEY, Order_date DATE NOT NULL, Route_number VARCHAR(10) NOT NULL, Start_date DATE NOT NULL, Number_of_person INTEGER NOT NULL, Total DECIMAL(8,2) NOT NULL, Payment_method VARCHAR(10) NOT NULL ) 31 DDL for Travel Agency - III Run this DDL to create table Customers under APP schema CREATE TABLE Customers ( Order_number VARCHAR(12) NOT NULL, Customer_name VARCHAR(30) NOT NULL, Package_type VARCHAR(10) NOT NULL, Travel_document VARCHAR(20) NOT NULL, PRIMARY KEY (Order_number,Customer_name) ) 32 16

17 Create a Table, tours via GUI - I Right-click Tables under APP schema Select Create Table Type TOURS as Table name, click Add column 33 Create a Table, tours via GUI - II Type details of column (or field), Route_number Constraints on column route_number NOT NULL 34 17

18 Create a Table, tours via GUI - III Do the same for remaining fields NOT NULL 35 Create a Table, tours via GUI - IV Click OK to create table process. NULL 36 18

19 Create a Table, tours via GUI - V Add primary key on (route_number, start_date) by following steps: Right-click Tours table, select Execute Command, type the following DDL. Alter table tours add primary key(route_number, start_date); Click Run SQL icon Right-click Tours table, select Refresh to see these 2 fields become primary key. If primary key consists of 2 or more columns, it could not be added to a table via GUI. 37 Data Type of Columns Table 5.1 Common data type categories supported by a relational database [p.23] Table 5.2 Descriptions of commonly used data types [p.24] Full list of data type, refer to 68.html 38 19

20 Constraints on Table Primary key (refer to A unique key that identifies each row in a table. Index (refer to a data structure that improves the speed of data retrieval operations on a database table at the cost of slower writes and increased storage space. Indexes can be created using one or more columns of a database table 39 Constraints on Column NULL [p.25 to 26] Denotes unknown or unspecified value Unique Every column value in the table should be unqiue, i.e. no duplicate values

21 Home Exercise on Creation of Database and Tables Create a database, travelagent in your computer with user name = dbuser, password = dbpassword Refer to previous slides on database creation Create the following tables under APP schema in database travelagent with DDL statements. (i.e Create Table statements given in previous slides) Routes, Tours, Orders, Customers Answer can be found in create_table SQL files in NetBeans project Unit5ExamplesBy [p.37 to 40] Inserting Data with DML INSERT Statement - I Meaning: add a record into a table in default schema. INSERT Syntax: (note: [ ] means optional) INSERT INTO Table_Name [(Field_List)] VALUES (Value_List) Examples: INSERT INTO Routes (Route_Number, Route_Name, Route_Description) VALUES ('HK2008', 'Hong Kong one-day tour', 'Visiting various famous sight-seeing scenes in Hong Kong in one day') -- The following insert is identical to the above one INSERT INTO Routes VALUES ('HK2008', 'Hong Kong one-day tour', 'Visiting various famous sight-seeing scenes in Hong Kong in one day') -- If a column allows NULL, can omit it in insert statement INSERT INTO Routes (Route_Number, Route_Name) VALUES ( TH2012', Thailand three-day tour') -- denotes single line comment

22 [p.37 to 40] Inserting Data with DML INSERT Statement - II If textual data specified by the SQL statement may contain an apostrophe, use any method below: -- Method 1: Use double apostrophe to escape apostrophe INSERT INTO Routes (Route_Number, Route_Name) VALUES ( HK2012', HK s two-day tour') -- Method 2: use \ to escape apostrophe INSERT INTO Routes (Route_Number, Route_Name) VALUES ( HK2012', HK\ s two-day tour') Exercise on Insert statement, Activity 5.2 [p.39] Answer can be found in NetBeans project Unit5Examples 43 [p.48] Updating Data with DML UPDATE Statement UPDATE Syntax: (Note: [ ] means optional, { } means repeating) Example UPDATE Table_Name SET Field_Name=New_Value {,Field_Name=New_Value} [WHERE Condition] UPDATE Tours SET Tea_gathering_date=' :00' WHERE Route_number= HK2008' AND Start_date=' Update record(s) in one table only If you need to update records in more than one table, you have to execute UPDATE statement for each table one by one

23 [p.48] Deleting Data with DML DELETE Statement DELETE Syntax: (Note: [ ] means optional) DELETE FROM Table_Name [WHERE Condition] Examples -- Delete record(s )with route_number = HK1997 DELETE FROM Routes WHERE Route_number='HK1997 ; Delete from one table only. -- delete all records in routes DELETE FROM routes; 45 View Data of an Existing Table, ROUTES DML SELECT Statement - I Click + on the left-hand-side of APP Click + on the left-hand-side of Tables Right-click ROUTES Select View Data Select statement of View Data.. No. of rows and no. of pages Content of table, ROUTES 46 23

24 DML SELECT Statement - II Syntax of SELECT statement [ ] denotes optional SELECT target_column_list FROM table_list [WHERE where_conditions] [GROUP BY group_by_column_list] [HAVING having_conditions] [ORDER BY order_by_column_list] List means that it can have more than 1 items. 47 Examples of SELECT Statement [p.40-44] - I -- select all fields from table routes, * denotes all fields Select * from routes; Run SQL Content of select statement 48 24

25 Examples of SELECT Statement [p.40-44] - II -- Get route name for non-null route description Select route_name from routes where route_description is not null; -- Get information for all HK routes, % denotes >= 0 characters Select * from routes where route_number like HK% ; -- Get order information in descending order of order date -- and ascending order of start date (keyword asc is optional) Select * from orders order by order_date desc, start_date asc; 49 Aggregate Functions of SELECT Statement [p.44-45] Table 5.8 A summary of aggregate functions [p.45] Aggregate functions: count, max, min, sum, avg Examples -- Get total no. of routes SELECT COUNT(*) AS Route_Total FROM Routes; -- Get no. of distinct routes that forms the tours SELECT COUNT(DISTINCT Route_Number) FROM Tours; Table 5.9 Examples of SQL SELECT queries that use aggregate functions [p.45] 50 25

26 Complex Joins of SELECT Statement [p.47-48] Join is a SELECT statement that involving more than 1 tables. -- Get route name of all routes that have orders SELECT routes.route_name FROM Routes, orders WHERE routes.route_number = orders.route_number; Sub-query means a SELECT in another one. -- identical with above statement SELECT route_name FROM Routes WHERE route_number in (select route_number from orders); 51 Database Programming in Java Programming Language ODBC (Open Database Connectivity) [p.51] Standard approach to access a database, especially a relational database. Introduced by Microsoft in 1992, but limited to Microsoft Windows only. Refer to JDBC (Java Database Connectivity) [p.51 to 52] Introduced as standard classes since Java 1.1 Refer to

27 4 Types of JDBC Driver [p.52, 80] Refer to JDBC Driver Type 1 driver (JDBC-ODBC bridge) Type 2 driver (Partial Java driver) Type 3 driver (Network-protocol driver) Type 4 driver (Native-protocol driver) Description uses a JDBC-ODBC bridge to connect to the desired DBMS. As ODBC is a proprietary to Windows, software applications that use this driver are not platform independent. Also, as there is extra overhead between the interaction of the JVM and the ODBC module, performance will be inferior to other types of JDBC drivers. calls platform-dependent binary code for database manipulations. Therefore, software applications that call this platform-dependent binary code are no longer platform independent. software applications call pure Java code to communicate with the DBMS. As pure Java code is platform independent, the software applications are platform independent. Needs to communicate to dedicated software module that manipulates the DBMS. Calls pure Java code to communicate with the DBMS. No need to communicate to dedicated software that manipulates the DBMS. 53 Connecting Database with JDBC JDBC driver [p.52] Type 1 and 2 are interim solutions, type 3 and 4 are for software deployment 2 methods to establish a database connection in Java program 1. Use DriverManager (simpler method) 2. Use DataSource (preferred method) Will discuss in Unit

28 Important JDBC jar file for JavaDB, Derby derbyclient.jar Ensure the DerbyClient.jar is in the libraries of your project. If not, do the following: Right-click Libraries Select Add Jar/Folder See slide #24 Select derbyclient.jar in <JavaDB installation folder>\lib 55 [p.53] Steps of Using DriverManager to Establish a Connection - I 1. Load a JDBC driver into the JVM. E.g. derby Class.forName("org.apache.derby.jdbc.ClientDriver"); 2. Call DriverManager.getConnection(url ) to get a connection object. // If Derby database, e.g. sample has no user name and password // Note: If the database is at another IP, just use the IP to replace localhost Connection conn = DriverManager.getConnection( " jdbc:derby://localhost:1527/sample"); In DerbyClient.jar // If Derby database, e.g. travelagent has user name and password Connection conn = DriverManager.getConnection( jdbc:derby://localhost:1527/travelagent, dbuser, dbpassword ); 56 28

29 [p.54] Steps of Using DriverManager to Establish a Connection - II 3. Get data from database. Read content in next slide 4. Release resources held by Connection object. conn.close(); 57 [p.56] Steps of Getting Data from Database (i.e. for SELECT) 1. Create a statement object Statement stmt = conn.createstatement(); 2. Execute Select statement with executequery(). ResultSet rs = stmt.executequery( select * from routes ); 3. Use rs.next() and rs.getobject( ) to get rows in result set. 4. Release resources held by ResultSet object and Statement object. rs.close(); stmt.close(); 58 29

30 Examples of Getting Data from Database Demonstrate Fig 5.18 DbmsDataGetter.java [p.58] with the following argument. org.apache.derby.jdbc.clientdriver jdbc:derby://localhost:1527/travelagent dbuser dbpassword app.routes Route_Number Route_Name Route_Description Note: routes is in APP schema. Needs to add schema name if it is different from user name of database Self-test 5.5 [p.60, 80-81] DisplayRoutes.java with try/catch, more robust than DbmsDataGetter.java. // Get no. of columns in table routes ResultSetMetaData metadata = resultset.getmetadata(); int numberofcolumns = metadata.getcolumncount(); 59 [p.60] Steps of Manipulating Data in a Database (i.e. for DDL or DML) 1. Create a prepared statement object. PreparedStatement is subclass of Statement. PreparedStatement stmt = conn.preparestatement( "DELETE FROM Routes WHERE Route_number=?"); /* use setxxx() method to update different placeholders according to XXX data type */ stmt.setstring(1, routenumber); // replace 1 st? (i.e. placeholder) by routenumber 2. Execute insert, update, delete with executeupdate(). stmt.executeupdate(); 3. Release resources held by PreparedStatement object. stmt.close(); 60 30

31 Why preparestatement is preferred? On submitting DML (select, insert, update, delete) statements, conn.preparestatement rather than createstatement should be used because: Better performance: preparestatement pre-compiles the query into execution plan, but createstatement does not. So preparestatement performs better than createstatement. For details, pls read this URL. Better security: automatic prevention of SQL injection attacks by built-in escaping the quotes and other special characters. For details, pls read this URL. 61 Home Exercise Familiarize with PreparedStatement, Statement, ResultSet Go to Read methods of PreparedStatement, Statement and ResultSet. For class ResultSet, read all getxxx() methods for different data types. Data type boolean int double Date XXX getxxx( ) getboolean(int columnindex), getboolean(string columnlabel) getint(int columnindex), getint(string columnlabel) getdouble(int columnindex), getdouble(string columnlabel) getdate(int columnindex), getdate(string columnlabel) 62 31

32 Case Study POJO - I [p.63 to 64] POJO (Plain Old Java Object) Refer to POJO is a Java object which does not follow any of the major Java object models, conventions, or frameworks. In this course, each POJO object can be used to store a record in a table. Strictly speaking, this kind of POJO is a Java Bean (refer to 63 Case Study POJO II [p.63 to 64] POJO example on routes table POJO Route.java in MT801_Unit5_Ans NetBeans project. Setter and getter methods defined on the above columns

33 Case Study DAO Concept [p.64-65] DAO (Data Access object) For SELECT : DAO populates values from database to POJO object. For INSERT, UPDATE, DELETE : DAO uses POJO object to update database. Refer to DAO usage diagram Database DAO for SELECT POJO object DAO for INSERT, UPDATE, DELETE 65 Case Study DAO Example [p.64-67] Table 5.11 Behaviours of the RouteDAO object 66 33

34 RouteDAO.java in MT801_Unit5_Ans RouteDAO.java in MT801_Unit5_Ans defines following methods void insert(route route) void update(route route) void delete(route route) List<Route> selectall() Return a list of route records. Route selectbyroutenumber(string routenumber) Return a single route record 67 Appendix Further Exploration [p.75] Optional (out of scope for this course) Data warehouses A large repository of data Data mining or data analytics Analytic skills to find pattern stored in data warehouse Business intelligence Use data mining technique to find useful information stored in data warehouse to assist management to make decision 68 34

35 Java DB (Derby) Reference Refer to Select a version of Derby (e.g. 10.8) first in the above URL ( Getting started with Derby Derby Reference Manual (i.e. SQL, JDBC) Derby Developer s Guide (i.e. JDBC Tuning Derby

Chapter 16: Databases

Chapter 16: Databases Chapter 16: Databases Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 16 discusses the following main topics: Introduction to Database

More information

Why use a database? You can query the data (run searches) You can integrate with other business systems that use the same database You can store huge

Why use a database? You can query the data (run searches) You can integrate with other business systems that use the same database You can store huge 175 Why use a database? You can query the data (run searches) You can integrate with other business systems that use the same database You can store huge numbers of records without the risk of corruption

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and

More information

Working with Databases and Java

Working 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 information

Programming in Java

Programming in Java 320341 Programming in Java Fall Semester 2014 Lecture 16: Introduction to Database Programming Instructor: Slides: Jürgen Schönwälder Bendick Mahleko Objectives This lecture introduces the following -

More information

Enterprise Java Unit 1- Chapter 6 Prof. Sujata Rizal

Enterprise Java Unit 1- Chapter 6 Prof. Sujata Rizal Introduction JDBC is a Java standard that provides the interface for connecting from Java to relational databases. The JDBC standard is defined by Sun Microsystems and implemented through the standard

More information

e-pg Pathshala Subject: Computer Science Paper: Web Technology Module: JDBC INTRODUCTION Module No: CS/WT/26 Quadrant 2 e-text

e-pg Pathshala Subject: Computer Science Paper: Web Technology Module: JDBC INTRODUCTION Module No: CS/WT/26 Quadrant 2 e-text e-pg Pathshala Subject: Computer Science Paper: Web Technology Module: JDBC INTRODUCTION Module No: CS/WT/26 Quadrant 2 e-text Learning Objectives This module gives an introduction about Java Database

More information

Accessing databases in Java using JDBC

Accessing databases in Java using JDBC Accessing databases in Java using JDBC Introduction JDBC is an API for Java that allows working with relational databases. JDBC offers the possibility to use SQL statements for DDL and DML statements.

More information

The Design of JDBC The Structured Query Language Basic JDBC Programming Concepts Query Execution Scrollable and Updatable Result Sets

The Design of JDBC The Structured Query Language Basic JDBC Programming Concepts Query Execution Scrollable and Updatable Result Sets Course Name: Advanced Java Lecture 13 Topics to be covered The Design of JDBC The Structured Query Language Basic JDBC Programming Concepts Query Execution Scrollable and Updatable Result Sets Introducing

More information

CGS 3066: Spring 2017 SQL Reference

CGS 3066: Spring 2017 SQL Reference CGS 3066: Spring 2017 SQL Reference Can also be used as a study guide. Only covers topics discussed in class. This is by no means a complete guide to SQL. Database accounts are being set up for all students

More information

SQL functions fit into two broad categories: Data definition language Data manipulation language

SQL functions fit into two broad categories: Data definition language Data manipulation language Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 7 Beginning Structured Query Language (SQL) MDM NUR RAZIA BINTI MOHD SURADI 019-3932846 razia@unisel.edu.my

More information

UNIT III - JDBC Two Marks

UNIT III - JDBC Two Marks UNIT III - JDBC Two Marks 1.What is JDBC? JDBC stands for Java Database Connectivity, which is a standard Java API for databaseindependent connectivity between the Java programming language and a wide

More information

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Database Connection Budditha Hettige Department of Statistics and Computer Science Budditha Hettige 1 From database to Java There are many brands of database: Microsoft

More information

The Object-Oriented Paradigm. Employee Application Object. The Reality of DBMS. Employee Database Table. From Database to Application.

The Object-Oriented Paradigm. Employee Application Object. The Reality of DBMS. Employee Database Table. From Database to Application. The Object-Oriented Paradigm CS422 Principles of Database Systems Object-Relational Mapping (ORM) Chengyu Sun California State University, Los Angeles The world consists of objects So we use object-oriented

More information

Questions and Answers. A. A DataSource is the basic service for managing a set of JDBC drivers.

Questions and Answers. A. A DataSource is the basic service for managing a set of JDBC drivers. Q.1) What is, in terms of JDBC, a DataSource? A. A DataSource is the basic service for managing a set of JDBC drivers B. A DataSource is the Java representation of a physical data source C. A DataSource

More information

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel 1 In this chapter, you will learn: The basic commands

More information

Lecture 2. Introduction to JDBC

Lecture 2. Introduction to JDBC Lecture 2 Introduction to JDBC Introducing JDBC According to Sun, JDBC is not an acronym, but is commonly misinterpreted to mean Java DataBase Connectivity JDBC: is an API that provides universal data

More information

DataBase Lab JAVA-DATABASE CONNECTION. Eng. Haneen El-masry

DataBase Lab JAVA-DATABASE CONNECTION. Eng. Haneen El-masry In the name of Allah Islamic University of Gaza Faculty of Engineering Computer Engineering Department ECOM 4113 DataBase Lab Lab # 9 JAVA-DATABASE CONNECTION El-masry 2013 Objective In this lab, we turn

More information

JDBC Drivers Type. JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server.

JDBC Drivers Type. JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server. JDBC Drivers Type 1 What is JDBC Driver? JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server. For example, using JDBC drivers enable you to open database

More information

Discuss setting up JDBC connectivity. Demonstrate a JDBC program Discuss and demonstrate methods associated with JDBC connectivity

Discuss setting up JDBC connectivity. Demonstrate a JDBC program Discuss and demonstrate methods associated with JDBC connectivity Objectives Discuss setting up JDBC connectivity. Demonstrate a JDBC program Discuss and demonstrate methods associated with JDBC connectivity Setting Up JDBC Before you can begin to utilize JDBC, you must

More information

JDBC Programming: Intro

JDBC Programming: Intro JDBC Programming: Intro Most interaction with DB is not via interactive interface Most people interact via 1. Application programs directly 2. Apps over the internet There are 3 general approaches to developing

More information

Tutorial: Using Java/JSP to Write a Web API

Tutorial: Using Java/JSP to Write a Web API Tutorial: Using Java/JSP to Write a Web API Contents 1. Overview... 1 2. Download and Install the Sample Code... 2 3. Study Code From the First JSP Page (where most of the code is in the JSP Page)... 3

More information

JDBC - INTERVIEW QUESTIONS

JDBC - INTERVIEW QUESTIONS JDBC - INTERVIEW QUESTIONS http://www.tutorialspoint.com/jdbc/jdbc_interview_questions.htm Copyright tutorialspoint.com Dear readers, these JDBC Interview Questions have been designed specially to get

More information

CSE 308. Database Issues. Goals. Separate the application code from the database

CSE 308. Database Issues. Goals. Separate the application code from the database CSE 308 Database Issues The following databases are created with password as changeit anticyber cyber cedar dogwood elm clan Goals Separate the application code from the database Encourages you to think

More information

Lab # 9. Java to Database Connection

Lab # 9. Java to Database Connection Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Lab # 9 Java to Database Connection Eng. Haneen El-Masry December, 2014 2 Objective In this lab, we turn

More information

CSE 135. Three-Tier Architecture. Applications Utilizing Databases. Browser. App. Server. Database. Server

CSE 135. Three-Tier Architecture. Applications Utilizing Databases. Browser. App. Server. Database. Server CSE 135 Applications Utilizing Databases Three-Tier Architecture Located @ Any PC HTTP Requests Browser HTML Located @ Server 2 App Server JDBC Requests JSPs Tuples Located @ Server 1 Database Server 2

More information

CSC Web Programming. Introduction to SQL

CSC Web Programming. Introduction to SQL CSC 242 - Web Programming Introduction to SQL SQL Statements Data Definition Language CREATE ALTER DROP Data Manipulation Language INSERT UPDATE DELETE Data Query Language SELECT SQL statements end with

More information

Unit 3 - Java Data Base Connectivity

Unit 3 - Java Data Base Connectivity Two-Tier Database Design The two-tier is based on Client-Server architecture. The direct communication takes place between client and server. There is no mediator between client and server. Because of

More information

SQL: Programming. Announcements (September 25) Motivation. CPS 116 Introduction to Database Systems. Pros and cons of SQL.

SQL: 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 information

SNS COLLEGE OF ENGINEERING, Coimbatore

SNS COLLEGE OF ENGINEERING, Coimbatore SNS COLLEGE OF ENGINEERING, Coimbatore 641 107 Accredited by NAAC UGC with A Grade Approved by AICTE and Affiliated to Anna University, Chennai IT6503 WEB PROGRAMMING UNIT 03 JDBC JDBC Overview JDBC implementation

More information

Database Access with JDBC. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

Database Access with JDBC. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark Database Access with JDBC Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Overview Overview of JDBC technology JDBC drivers Seven basic steps in using JDBC Retrieving

More information

Bonus Content. Glossary

Bonus Content. Glossary Bonus Content Glossary ActiveX control: A reusable software component that can be added to an application, reducing development time in the process. ActiveX is a Microsoft technology; ActiveX components

More information

UNIT-3 Java Database Client/Server

UNIT-3 Java Database Client/Server UNIT-3 Java Database Client/Server TOPICS TO BE COVERED 3.1 Client-Server Design: Two-Tier Database Design, Three-Tier Database Design 3.2 The JDBC API: The API Components, Database Creation, table creation

More information

JDBC BASIC 19/05/2012. Objectives. Java Database Connectivity. Definitions of JDBC. Part 1. JDBC basic Working with JDBC Adv anced JDBC programming

JDBC BASIC 19/05/2012. Objectives. Java Database Connectivity. Definitions of JDBC. Part 1. JDBC basic Working with JDBC Adv anced JDBC programming Objectives Java Database Connectivity JDBC basic Working with JDBC Adv anced JDBC programming By Võ Văn Hải Faculty of Information Technologies Summer 2012 2/27 Definitions of JDBC JDBC APIs, which provides

More information

JDBC Architecture. JDBC API: This provides the application-to- JDBC Manager connection.

JDBC Architecture. JDBC API: This provides the application-to- JDBC Manager connection. JDBC PROGRAMMING JDBC JDBC Java DataBase Connectivity Useful for database driven applications Standard API for accessing relational databases Compatible with wide range of databases Current Version JDBC

More information

Chapter # 7 Introduction to Structured Query Language (SQL) Part I

Chapter # 7 Introduction to Structured Query Language (SQL) Part I Chapter # 7 Introduction to Structured Query Language (SQL) Part I Introduction to SQL SQL functions fit into two broad categories: Data definition language Data manipulation language Basic command set

More information

Java Database Connectivity (JDBC) 25.1 What is JDBC?

Java Database Connectivity (JDBC) 25.1 What is JDBC? PART 25 Java Database Connectivity (JDBC) 25.1 What is JDBC? JDBC stands for Java Database Connectivity, which is a standard Java API for database-independent connectivity between the Java programming

More information

Chapter-14 SQL COMMANDS

Chapter-14 SQL COMMANDS Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language

More information

PERSİSTENCE OBJECT RELATİON MAPPİNG

PERSİSTENCE OBJECT RELATİON MAPPİNG PERSİSTENCE Most of the applications require storing and retrieving objects in a persistent storage mechanism. This chapter introduces how to store and retrieve information in a persistent storage with

More information

Embedded 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 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 information

Wentworth Institute of Technology COMP570 Database Applications Fall 2014 Derbinsky. SQL Programming. Lecture 8. SQL Programming

Wentworth Institute of Technology COMP570 Database Applications Fall 2014 Derbinsky. SQL Programming. Lecture 8. SQL Programming Lecture 8 1 Outline Context General Approaches Typical Programming Sequence Examples 2 Database Design and Implementation Process Normalization 3 SQL via API Embedded SQL SQLJ General Approaches DB Programming

More information

Data about data is database Select correct option: True False Partially True None of the Above

Data about data is database Select correct option: True False Partially True None of the Above Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another

More information

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH 2017 Institute of Aga Network Database LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece of

More information

Database Application Development

Database 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 information

Top 50 JDBC Interview Questions and Answers

Top 50 JDBC Interview Questions and Answers Top 50 JDBC Interview Questions and Answers 1) What is the JDBC? JDBC stands for Java Database Connectivity. JDBC is a Java API that communicates with the database and execute SQLquery. 2) What is a JDBC

More information

13 Creation and Manipulation of Tables and Databases

13 Creation and Manipulation of Tables and Databases 150.420 Informationslogistik SQL Handout No. 9 SS 2013 13 Creation and Manipulation of Tables and Databases 13.1 Creation and Deletion Databases can be created and deleted using respectively. CREATE DATABASE

More information

This lecture. Databases - JDBC I. Application Programs. Database Access End Users

This lecture. Databases - JDBC I. Application Programs. Database Access End Users This lecture Databases - I The lecture starts discussion of how a Java-based application program connects to a database using. (GF Royle 2006-8, N Spadaccini 2008) Databases - I 1 / 24 (GF Royle 2006-8,

More information

ERwin and JDBC. Mar. 6, 2007 Myoung Ho Kim

ERwin and JDBC. Mar. 6, 2007 Myoung Ho Kim ERwin and JDBC Mar. 6, 2007 Myoung Ho Kim ERwin ERwin a popular commercial ER modeling tool» other tools: Dia (open source), Visio, ConceptDraw, etc. supports database schema generation 2 ERwin UI 3 Data

More information

Introduction to SQL & Database Application Development Using Java

Introduction to SQL & Database Application Development Using Java Introduction to SQL & Database Application Development Using Java By Alan Andrea The purpose of this paper is to give an introduction to relational database design and sql with a follow up on how these

More information

Operating systems fundamentals - B07

Operating systems fundamentals - B07 Operating systems fundamentals - B07 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems fundamentals - B07 1 / 33 What is SQL? Structured Query Language Used

More information

Java and the Java DataBase Connectivity (JDBC) API. Todd Kaufman April 25, 2002

Java and the Java DataBase Connectivity (JDBC) API. Todd Kaufman April 25, 2002 Java and the Java DataBase Connectivity (JDBC) API Todd Kaufman April 25, 2002 Agenda BIO Java JDBC References Q&A Speaker 4 years Java experience 4 years JDBC experience 3 years J2EE experience BS from

More information

Data Base Concepts. Course Guide 2

Data Base Concepts. Course Guide 2 MS Access Chapter 1 Data Base Concepts Course Guide 2 Data Base Concepts Data The term data is often used to distinguish binary machine-readable information from textual human-readable information. For

More information

Cyrus Shahabi Computer Science Department University of Southern California C. Shahabi

Cyrus 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 information

Application Programming for Relational Databases

Application 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 information

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

SQL language. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) SQL language Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 SQL - Structured Query Language SQL is a computer language for communicating with DBSM Nonprocedural (declarative) language What

More information

BUSINESS INTELLIGENCE LABORATORY. Data Access: Relational Data Bases. Business Informatics Degree

BUSINESS INTELLIGENCE LABORATORY. Data Access: Relational Data Bases. Business Informatics Degree BUSINESS INTELLIGENCE LABORATORY Data Access: Relational Data Bases Business Informatics Degree RDBMS data access 2 Protocols and API ODBC, OLE DB, ADO, ADO.NET, JDBC JDBC Programming Java classes java.sql

More information

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH Institute of Aga 2018 Microsoft SQL Server LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece

More information

CSCI/CMPE Object-Oriented Programming in Java JDBC. Dongchul Kim. Department of Computer Science University of Texas Rio Grande Valley

CSCI/CMPE Object-Oriented Programming in Java JDBC. Dongchul Kim. Department of Computer Science University of Texas Rio Grande Valley CSCI/CMPE 3326 Object-Oriented Programming in Java JDBC Dongchul Kim Department of Computer Science University of Texas Rio Grande Valley Introduction to Database Management Systems Storing data in traditional

More information

JDBC [Java DataBase Connectivity]

JDBC [Java DataBase Connectivity] JDBC [Java DataBase Connectivity] Introduction Almost all the web applications need to work with the data stored in the databases. JDBC is Java specification that allows the Java programs to access the

More information

SQL Commands & Mongo DB New Syllabus

SQL Commands & Mongo DB New Syllabus Chapter 15 : Computer Science Class XI ( As per CBSE Board) SQL Commands & Mongo DB New Syllabus 2018-19 SQL SQL is an acronym of Structured Query Language.It is a standard language developed and used

More information

Java Database Connectivity

Java Database Connectivity Java Database Connectivity INTRODUCTION Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in Agenda Introduction

More information

Non-interactive SQL. EECS Introduction to Database Management Systems

Non-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 information

Index. Bitmap Heap Scan, 156 Bitmap Index Scan, 156. Rahul Batra 2018 R. Batra, SQL Primer,

Index. Bitmap Heap Scan, 156 Bitmap Index Scan, 156. Rahul Batra 2018 R. Batra, SQL Primer, A Access control, 165 granting privileges to users general syntax, GRANT, 170 multiple privileges, 171 PostgreSQL, 166 169 relational databases, 165 REVOKE command, 172 173 SQLite, 166 Aggregate functions

More information

Student Number: Please fill out the identification section above as well as the one on the back page, and read the instructions below. Good Luck!

Student Number: Please fill out the identification section above as well as the one on the back page, and read the instructions below. Good Luck! CSC 343H1S 2013 Test 2 Duration 50 minutes Aids allowed: none Last Name: Lecture Section: Day Student Number: First Name: Instructor: Horton Please fill out the identification section above as well as

More information

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1 SQL Fundamentals Chapter 3 Class 03: SQL Fundamentals 1 Class 03: SQL Fundamentals 2 SQL SQL (Structured Query Language): A language that is used in relational databases to build and query tables. Earlier

More information

Pieter van den Hombergh. March 25, 2018

Pieter van den Hombergh. March 25, 2018 ergh Fontys Hogeschool voor Techniek en Logistiek March 25, 2018 ergh/fhtenl March 25, 2018 1/25 JDBC JDBC is a Java database connectivity technology (Java Standard Edition platform) from Oracle Corporation.

More information

Fundamentals of Information Systems, Seventh Edition

Fundamentals of Information Systems, Seventh Edition Chapter 3 Data Centers, and Business Intelligence 1 Why Learn About Database Systems, Data Centers, and Business Intelligence? Database: A database is an organized collection of data. Databases also help

More information

Outline. Lecture 10: Database Connectivity -JDBC. Java Persistence. Persistence via Database

Outline. Lecture 10: Database Connectivity -JDBC. Java Persistence. Persistence via Database Outline Lecture 10: Database Connectivity -JDBC Persistence via Database JDBC (Java Database Connectivity) JDBC API Wendy Liu CSC309F Fall 2007 1 2 Java Persistence Persistence via Database JDBC (Java

More information

Today Learning outcomes LO2

Today Learning outcomes LO2 2015 2016 Phil Smith Today Learning outcomes LO2 On successful completion of this unit you will: 1. Be able to design and implement relational database systems. 2. Requirements. 3. User Interface. I am

More information

Unit 2 JDBC Programming

Unit 2 JDBC Programming Q1. What is JDBC? Explain the types of JDBC drivers? Ans. What is JDBC? JDBC is an API, which is used in java programming for interacting with database. JDBC (Java DataBase Connection) is the standard

More information

DB Programming. Database Systems

DB Programming. Database Systems DB Programming Database Systems 1 Agenda MySQL data types Altering the Schema More Advanced MySQL JDBC DB Coding Tips 2 MySQL Data Types There are 3 main groups of types: Numeric Date String http://dev.mysql.com/doc/refman/5.6/en/data-types.html

More information

Relation Databases. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region. Based on CBSE Curriculum Class -11. Neha Tyagi, PGT CS II Shift Jaipur

Relation Databases. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region. Based on CBSE Curriculum Class -11. Neha Tyagi, PGT CS II Shift Jaipur Relation Databases Based on CBSE Curriculum Class -11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region Neha Tyagi, PGT CS II Shift Jaipur Introduction A Database System is basically a record keeping

More information

RDBMS-Day3. SQL Basic DDL statements DML statements Aggregate functions

RDBMS-Day3. SQL Basic DDL statements DML statements Aggregate functions RDBMS-Day3 SQL Basic DDL statements DML statements Aggregate functions SQL SQL is used to make a request to retrieve data from a Database. The DBMS processes the SQL request, retrieves the requested data

More information

SQL: Programming Midterm in class next Thursday (October 5)

SQL: Programming Midterm in class next Thursday (October 5) Announcements (September 28) 2 Homework #1 graded Homework #2 due today Solution available this weekend SQL: Programming Midterm in class next Thursday (October 5) Open book, open notes Format similar

More information

SQL in a Server Environment

SQL in a Server Environment SQL in a Server Environment Vaidė Narváez Computer Information Systems January 13th, 2011 The Three-Tier Architecture Application logic components Copyright c 2009 Pearson Education, Inc. Publishing as

More information

COP4540 TUTORIAL PROFESSOR: DR SHU-CHING CHEN TA: H S IN-YU HA

COP4540 TUTORIAL PROFESSOR: DR SHU-CHING CHEN TA: H S IN-YU HA COP4540 TUTORIAL PROFESSOR: DR SHU-CHING CHEN TA: H S IN-YU HA OUTLINE Postgresql installation Introduction of JDBC Stored Procedure POSTGRES INSTALLATION (1) Extract the source file Start the configuration

More information

Course Details Duration: 3 days Starting time: 9.00 am Finishing time: 4.30 pm Lunch and refreshments are provided.

Course Details Duration: 3 days Starting time: 9.00 am Finishing time: 4.30 pm Lunch and refreshments are provided. Database Administration with PostgreSQL Introduction This is a 3 day intensive course in skills and methods for PostgreSQL. Course Details Duration: 3 days Starting time: 9.00 am Finishing time: 4.30 pm

More information

COMP102: Introduction to Databases, 23

COMP102: Introduction to Databases, 23 COMP102: Introduction to Databases, 23 Dr Muhammad Sulaiman Khan Department of Computer Science University of Liverpool U.K. 04 April, 2011 Programming with SQL Specific topics for today: Client/Server

More information

Embedded 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 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 information

Analytics: Server Architect (Siebel 7.7)

Analytics: Server Architect (Siebel 7.7) Analytics: Server Architect (Siebel 7.7) Student Guide June 2005 Part # 10PO2-ASAS-07710 D44608GC10 Edition 1.0 D44917 Copyright 2005, 2006, Oracle. All rights reserved. Disclaimer This document contains

More information

Chapter 3: Introduction to SQL

Chapter 3: Introduction to SQL Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query

More information

Running SQL in Java and PHP

Running 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 information

JAVA AND DATABASES. Summer 2018

JAVA AND DATABASES. Summer 2018 JAVA AND DATABASES Summer 2018 JDBC JDBC (Java Database Connectivity) an API for working with databases in Java (works with any tabular data, but focuses on relational databases) Works with 3 basic actions:

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) SQL-Part III & Storing Data: Disks and Files- Part I Lecture 8, February 5, 2014 Mohammad Hammoud Today Last Session: Standard Query Language (SQL)- Part II Today s Session:

More information

Persistency Patterns. Repository and DAO

Persistency Patterns. Repository and DAO Persistency Patterns Repository and DAO 1 Repository pattern Basically, the Repository pattern just means putting a façade over your persistence system so that you can shield the rest of your application

More information

JDBC Java Database Connectivity is a Java feature that lets you connect

JDBC Java Database Connectivity is a Java feature that lets you connect Chapter 4: Using JDBC to Connect to a Database In This Chapter Configuring JDBC drivers Creating a connection Executing SQL statements Retrieving result data Updating and deleting data JDBC Java Database

More information

Part I: Stored Procedures. Introduction to SQL Programming Techniques. CSC 375, Fall 2017

Part I: Stored Procedures. Introduction to SQL Programming Techniques. CSC 375, Fall 2017 Introduction to SQL Programming Techniques CSC 375, Fall 2017 The Six Phases of a Project: Enthusiasm Disillusionment Panic Search for the Guilty Punishment of the Innocent Praise for non-participants

More information

Database System Concepts and Architecture

Database System Concepts and Architecture CHAPTER 2 Database System Concepts and Architecture Copyright 2017 Ramez Elmasri and Shamkant B. Navathe Slide 2-2 Outline Data Models and Their Categories History of Data Models Schemas, Instances, and

More information

Database Application Development

Database Application Development CS 461: Database Systems Database Application Development supplementary material: Database Management Systems Sec. 6.2, 6.3 DBUtils.java, Student.java, Registrar.java, RegistrarServlet.java, PgRegistrar.sql

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6-2 Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features

More information

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1 Basic Concepts :- 1. What is Data? Data is a collection of facts from which conclusion may be drawn. In computer science, data is anything in a form suitable for use with a computer. Data is often distinguished

More information

JDBC. Sun Microsystems has included JDBC API as a part of J2SDK to develop Java applications that can communicate with databases.

JDBC. Sun Microsystems has included JDBC API as a part of J2SDK to develop Java applications that can communicate with databases. JDBC The JDBC TM API is the application programming interface that provides universal data access for the Java TM platform. In other words, the JDBC API is used to work with a relational database or other

More information

Chapter 10 Java and SQL. Wang Yang

Chapter 10 Java and SQL. Wang Yang Chapter 10 Java and SQL Wang Yang wyang@njnet.edu.cn Outline Concern Data - File & IO vs. Database &SQL Database & SQL How Connect Java to SQL - Java Model for Database Java Database Connectivity (JDBC)

More information

JDBC 3.0. Java Database Connectivity. 1 Java

JDBC 3.0. Java Database Connectivity. 1 Java JDBC 3.0 Database Connectivity 1 Contents 1 JDBC API 2 JDBC Architecture 3 Steps to code 4 Code 5 How to configure the DSN for ODBC Driver for MS-Access 6 Driver Types 7 JDBC-ODBC Bridge 8 Disadvantages

More information

Course Outline and Objectives: Database Programming with SQL

Course Outline and Objectives: Database Programming with SQL Introduction to Computer Science and Business Course Outline and Objectives: Database Programming with SQL This is the second portion of the Database Design and Programming with SQL course. In this portion,

More information

More Database Programming. CS157A Chris Pollett Nov. 2, 2005.

More Database Programming. CS157A Chris Pollett Nov. 2, 2005. More Database Programming CS157A Chris Pollett Nov. 2, 2005. Outline JDBC SQLJ Introduction Last day we went over some JDBC and SQLJ code examples from prior classes. Today, we will discuss JDBC and SQLJ

More information

Running SQL in Java and PHP

Running 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 information

Why Relational Databases? Relational databases allow for the storage and analysis of large amounts of data.

Why Relational Databases? Relational databases allow for the storage and analysis of large amounts of data. DATA 301 Introduction to Data Analytics Relational Databases Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Relational Databases? Relational

More information

Manual Trigger Sql Server 2008 Examples Insert Update

Manual Trigger Sql Server 2008 Examples Insert Update Manual Trigger Sql Server 2008 Examples Insert Update blog.sqlauthority.com/2011/03/31/sql-server-denali-a-simple-example-of you need to manually delete this trigger or else you can't get into master too

More information

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210 SQL: Concepts Todd Bacastow IST 210: Organization of Data 2/17/2004 1 Design questions How many entities are there? What are the major entities? What are the attributes of each entity? Is there a unique

More information