This document discusses different approaches for database programming, including embedded SQL, stored procedures, and Java Database Connectivity (JDBC). It covers key topics such as impedance mismatch between programming languages and databases, steps for database access, and examples of embedded SQL, stored procedures, and JDBC code. The overall goal is to explain how application programs can interact with a database.
This document discusses different approaches for database programming, including embedded SQL, stored procedures, and Java Database Connectivity (JDBC). It covers key topics such as impedance mismatch between programming languages and databases, steps for database access, and examples of embedded SQL, stored procedures, and JDBC code. The overall goal is to explain how application programs can interact with a database.
This document discusses different approaches for database programming, including embedded SQL, stored procedures, and Java Database Connectivity (JDBC). It covers key topics such as impedance mismatch between programming languages and databases, steps for database access, and examples of embedded SQL, stored procedures, and JDBC code. The overall goal is to explain how application programs can interact with a database.
This document discusses different approaches for database programming, including embedded SQL, stored procedures, and Java Database Connectivity (JDBC). It covers key topics such as impedance mismatch between programming languages and databases, steps for database access, and examples of embedded SQL, stored procedures, and JDBC code. The overall goal is to explain how application programs can interact with a database.
application program (as opposed to interactive interfaces) Why? An interactive interface is convenient but not sufficient; a majority of database operations are made through application programs
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 9-2
programming language and the database model, e.g., – type mismatch and incompatibilities; requires a new binding for each language – set vs. record-at-a-time processing need special iterators to loop over query results and manipulate individual values
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 9-4
the database server 2. Client program submits queries to and/or updates the database 3. When database access is no longer needed, client program terminates the connection
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 9-5
Java An SQLJ translator converts SQL statements into Java (to be executed through the JDBC interface) Certain classes, e.g., java.sql have to be imported
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 9-12
– named iterator: associated with a query result – positional iterator: lists only attribute types in a query result A FETCH operation retrieves the next tuple in a query result: fetch iterator-variable into program-variable
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 9-14
Java programming A Java program with JDBC functions can access any relational DBMS that has a JDBC driver JDBC allows a program to connect to several databases (known as data sources)
Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 9-17