SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
UU - IT - UDBL                                                                   1




                   DATABASE DESIGN I - 1DL300
                                     Summer 2009


                    An introductury course on database systems
                              http://user.it.uu.se/~udbl/dbt-sommar09/
                 alt. http://www.it.uu.se/edu/course/homepage/dbastekn/st09/


                                        Kjell Orsborn
                                    Uppsala Database Laboratory
                     Department of Information Technology, Uppsala University,
                                         Uppsala, Sweden

Kjell Orsborn                                8/12/09
UU - IT - UDBL                                          2




                    Database API:s

                     (Elmasri/Navathe ch. 9)
                  (Padron-McCarthy/Risch ch 20)


                           Kjell Orsborn

                 Department of Information Technology
                 Uppsala University, Uppsala, Sweden




Kjell Orsborn                   8/12/09
UU - IT - UDBL                                                                 3




                  Database user interfaces

• Textual interfaces
       – Such as BSQL for Mimer
• Graphical interfaces
       – Most well-known is QBE (Query-By-Example) originally developed by
         IBM. MS Access uses a QBE variant.
• SQL application programming interfaces
       – Requires management of sessions, sql statements and some control of
         query optimization.
       – Call-level interfaces
       – Embedded SQL



Kjell Orsborn                         8/12/09
UU - IT - UDBL                                                                                4



                             Call-Level Interfaces
•    Vendor-specific call-level interfaces
       – An SQL API usually for one or several host languages like C, C++, Java, Fortan, COBOL etc.
       – Support to manage sessions, SQL statements and data conversions
•    SQL Call Level Interface (CLI),
       – The Call Level Interface (CLI) is a standard SQL API created by The Open Group. The API is
         defined for C and COBOL only. ISBN: 1-85912-081-4, X/Open Document Number: C451,
         1995.
•    SQL/CLI
       – Call-Level Interface (SQL/CLI) is an implementation-independent CLI to access SQL
         databases. SQL/CLI is an ISO standard ISO/IEC 9075-3:1995 Information technology --
         Database languages -- SQL -- Part 3: Call-Level Interface (SQL/CLI). The current SQL/CLI
         effort is adding support for SQL:1999.
•    ODBC
       – (Microsoft) Open Database Connectivity is a standard SQL API. ODBC is based on the Call
         Level Interface (CLI) specifications from SQL, X/Open (now part of The Open Group), and
         the ISO/IEC. ODBC was created by the SQL Access Group and released Sept, 1992.
•    JDBC - Java Database Connectivity
       – JDBC is an SQL API for Java (to be strictly correct, JDBC is not an acronym).

Kjell Orsborn                                 8/12/09
UU - IT - UDBL                                     5




                 The ODBC architecture
• ODBC API is independent of any one programming
  language, database system or operating system.




Kjell Orsborn             8/12/09
UU - IT - UDBL                                                 6




                 The JDBC architecture
• JDBC API is independent of (relational) DBMS and operating
  system




Kjell Orsborn               8/12/09
UU - IT - UDBL                                            7




      Alt. JDBC architecture (JDBC-ODBC bridge)
• Makes ODBC accessible from JDBC such that no special JDBC
  drivers are required.




Kjell Orsborn              8/12/09
UU - IT - UDBL                                                                          8




       Programming with SQL CLI interfaces
                                  JDBC example

•    The JDBC API (Application Program Interface) is a set of Java interfaces
     that allow database applications to:
       – open connections to a database,
       – execute SQL statements, and
       – process the results.
•    These include:
       – java.sql.DriverManager, which loads the specific drivers and supports creating
         new database connections
       – java.sql.Connection, which represents a connection to a specific database
       – java.sql.Statement, which allows the application to execute a SQL statement
       – java.sql.PreparedStatement, which represents a pre-compiled SQL statement
       – java.sql.ResultSet, controls access to rows resulting from executing a statement


Kjell Orsborn                              8/12/09
UU - IT - UDBL                                                                          9


                                          JDBC example
        import java.sql.*;

        public class JDBCExample {

           public static void main(String args[]) {

                 String url = "jdbc:mySubprotocol:myDataSource";
                 Connection con;
                 String query = "SELECT NAME FROM EMPLOYEE WHERE INCOME > 10000";
                 Statement stmt;

                 try {
                     Class.forName("myDriver.ClassName");
                 }catch(java.lang.ClassNotFoundException e) {
                    System.err.print("ClassNotFoundException: ");
                    System.err.println(e.getMessage());
                 }

                 try {
                     con = DriverManager.getConnection(url, "myLogin", "myPassword");
                     stmt = con.createStatement();
                     ResultSet rs = stmt.executeQuery(query);
                     while (rs.next()) {
                        String s = rs.getString(”NAME");
                        System.out.println(s);
                     }
                     rs.close();
                     stmt.close();
                     con.close();
                 }catch(SQLException ex) {
                    System.err.print("SQLException: ");
                    System.err.println(ex.getMessage()); }}}

Kjell Orsborn                                 8/12/09
UU - IT - UDBL                                                                     10


                              JDBC example (prepared statement)
  import java.sql.*;

  public class JDBCExample {
     public static void main(String args[]) {

            String url = "jdbc:mySubprotocol:myDataSource";
            Connection con;
            String query = "SELECT NAME FROM EMPLOYEE WHERE INCOME > ?;
            Int incomeLimit;
            PreparedStatement stmt;

            try {
                Class.forName("myDriver.ClassName");
            }catch(java.lang.ClassNotFoundException e) {
               System.err.print("ClassNotFoundException: ");
               System.err.println(e.getMessage());
            }
            try {
                con = DriverManager.getConnection(url, "myLogin", "myPassword");
            stmt = con.prepareStatement(query);
            while(....) {
               .... // Code to read lower income limit into incomeLimit
            stmt.setInt(1,incomeLimit);
            ResultSet rs = stmt.executeQuery();
                while (rs.next()) {
                   System.out.println(rs.getString(”NAME"));
                }}
                rs.close();
                stmt.close();
                con.close();
            }catch(SQLException ex) {
               System.err.print("SQLException: ");
               System.err.println(ex.getMessage()); }}}
Kjell Orsborn                                 8/12/09
UU - IT - UDBL                                                                11




                          Embedded SQL

•    Host language include embedded and specially marked SQL statements.
•    Embedded statements are extracted by preprocessor, translated and replaced
     by database calls, precompiled (prepared) and stored on server.
•    The preprocessed application is then compiled normally
•    Supports dynamic recompilation
•    Reduces optimization cost and can be somewhat simpler than CLI
     programming.




Kjell Orsborn                         8/12/09

Más contenido relacionado

La actualidad más candente

06 Using More Package Concepts
06 Using More Package Concepts06 Using More Package Concepts
06 Using More Package Conceptsrehaniltifat
 
05 Creating Stored Procedures
05 Creating Stored Procedures05 Creating Stored Procedures
05 Creating Stored Proceduresrehaniltifat
 
Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004
Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004
Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004derek_clark_ashmore
 
Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004
Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004
Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004derek_clark_ashmore
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilarrehaniltifat
 
02 Writing Executable Statments
02 Writing Executable Statments02 Writing Executable Statments
02 Writing Executable Statmentsrehaniltifat
 
Less01 architecture
Less01 architectureLess01 architecture
Less01 architectureAmit Bhalla
 
Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001jucaab
 
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...rehaniltifat
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadatarehaniltifat
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Less07 schema
Less07 schemaLess07 schema
Less07 schemaImran Ali
 
Less14 br concepts
Less14 br conceptsLess14 br concepts
Less14 br conceptsAmit Bhalla
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLGuatemala User Group
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-onlyAshwin Kumar
 

La actualidad más candente (20)

06 Using More Package Concepts
06 Using More Package Concepts06 Using More Package Concepts
06 Using More Package Concepts
 
plsql les10
 plsql les10 plsql les10
plsql les10
 
05 Creating Stored Procedures
05 Creating Stored Procedures05 Creating Stored Procedures
05 Creating Stored Procedures
 
Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004
Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004
Jdbc Best Practices - Oracle/IOUG, Toronto, April 21, 2004
 
Less03 db dbca
Less03 db dbcaLess03 db dbca
Less03 db dbca
 
Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004
Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004
Jdbc Best Practices - DB2/ IDUG - Orlando, May 10, 2004
 
11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar11 Understanding and Influencing the PL/SQL Compilar
11 Understanding and Influencing the PL/SQL Compilar
 
PHP Oracle
PHP OraclePHP Oracle
PHP Oracle
 
02 Writing Executable Statments
02 Writing Executable Statments02 Writing Executable Statments
02 Writing Executable Statments
 
Less01 architecture
Less01 architectureLess01 architecture
Less01 architecture
 
Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001Ebs dba con4696_pdf_4696_0001
Ebs dba con4696_pdf_4696_0001
 
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata08 Dynamic SQL and Metadata
08 Dynamic SQL and Metadata
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Less07 schema
Less07 schemaLess07 schema
Less07 schema
 
Less14 br concepts
Less14 br conceptsLess14 br concepts
Less14 br concepts
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQL
 
321 Rac
321 Rac321 Rac
321 Rac
 
3963066 pl-sql-notes-only
3963066 pl-sql-notes-only3963066 pl-sql-notes-only
3963066 pl-sql-notes-only
 

Similar a Database design i_-_1_dl300

Advanced sql injection
Advanced sql injectionAdvanced sql injection
Advanced sql injectionbadhanbd
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developerswebhostingguy
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hydewebhostingguy
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming LanguagesS.Shayan Daneshvar
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration BackendArun Gupta
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL Suraj Bang
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersKrzysztof Kotowicz
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012Arun Gupta
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And XmlDavid Truxall
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingAnton Keks
 
PROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part IPROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part ISivaSankari36
 
Vision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdfVision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdfbhagyashri686896
 
Vision_Academy_Ajava_final(sachin_sir9823037693)_22.pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22.pdfVision_Academy_Ajava_final(sachin_sir9823037693)_22.pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22.pdfVisionAcademyProfSac
 

Similar a Database design i_-_1_dl300 (20)

Advanced sql injection
Advanced sql injectionAdvanced sql injection
Advanced sql injection
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL OWB11gR2 - Extending ETL
OWB11gR2 - Extending ETL
 
Day2
Day2Day2
Day2
 
Jdbc
JdbcJdbc
Jdbc
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developers
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
Jdbc
JdbcJdbc
Jdbc
 
SQL injection: Not only AND 1=1
SQL injection: Not only AND 1=1SQL injection: Not only AND 1=1
SQL injection: Not only AND 1=1
 
Lecture17
Lecture17Lecture17
Lecture17
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & Logging
 
Jdbc
JdbcJdbc
Jdbc
 
PROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part IPROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part I
 
Vision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdfVision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22 (1).pdf
 
Vision_Academy_Ajava_final(sachin_sir9823037693)_22.pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22.pdfVision_Academy_Ajava_final(sachin_sir9823037693)_22.pdf
Vision_Academy_Ajava_final(sachin_sir9823037693)_22.pdf
 
Jdbc ja
Jdbc jaJdbc ja
Jdbc ja
 

Último

Heidi Livengood's Professional CADD Portfolio
Heidi Livengood's Professional CADD PortfolioHeidi Livengood's Professional CADD Portfolio
Heidi Livengood's Professional CADD PortfolioHeidiLivengood
 
Real Smart Art Infographics by Slidesgo.pptx
Real Smart Art Infographics by Slidesgo.pptxReal Smart Art Infographics by Slidesgo.pptx
Real Smart Art Infographics by Slidesgo.pptxArindamMookherji1
 
如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证ugzga
 
Webhost NVME Cloud VPS Hosting1234455678
Webhost NVME Cloud VPS Hosting1234455678Webhost NVME Cloud VPS Hosting1234455678
Webhost NVME Cloud VPS Hosting1234455678Cloud99 Cloud
 
Bit Dhrumi shah Graphic Designer portfolio
Bit Dhrumi shah Graphic Designer portfolioBit Dhrumi shah Graphic Designer portfolio
Bit Dhrumi shah Graphic Designer portfoliodhrumibshah13
 
如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证ugzga
 
CADD 141 - Puzzle Cube Project - Product Photos
CADD 141 - Puzzle Cube Project - Product PhotosCADD 141 - Puzzle Cube Project - Product Photos
CADD 141 - Puzzle Cube Project - Product PhotosDuyDo100
 
如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证ugzga
 
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证ugzga
 
Avoid these common UI/UX design mistakes
 Avoid these common UI/UX design mistakes Avoid these common UI/UX design mistakes
Avoid these common UI/UX design mistakesuistudiozdesign
 
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证ugzga
 
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理thubko
 
Recycled Modular Low Cost Construction .pdf
Recycled Modular Low Cost Construction .pdfRecycled Modular Low Cost Construction .pdf
Recycled Modular Low Cost Construction .pdfjeffreycarroll14
 
CADD 141 - BIRD Scooter - Cup Holder Photos.pdf
CADD 141 - BIRD Scooter - Cup Holder Photos.pdfCADD 141 - BIRD Scooter - Cup Holder Photos.pdf
CADD 141 - BIRD Scooter - Cup Holder Photos.pdfDuyDo100
 
如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证ugzga
 
如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证ugzga
 
Explaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdf
Explaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdfExplaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdf
Explaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdfFreixa Home Design
 
Spring Summer 2026 Inspirations trend book Peclers Paris
Spring Summer 2026 Inspirations trend book Peclers ParisSpring Summer 2026 Inspirations trend book Peclers Paris
Spring Summer 2026 Inspirations trend book Peclers ParisPeclers Paris
 
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjjWeek 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjjjoshuaclack73
 
Onyx Tiles Where Elegance Meets Durability
Onyx Tiles Where Elegance Meets DurabilityOnyx Tiles Where Elegance Meets Durability
Onyx Tiles Where Elegance Meets DurabilityTracy Lipscomb
 

Último (20)

Heidi Livengood's Professional CADD Portfolio
Heidi Livengood's Professional CADD PortfolioHeidi Livengood's Professional CADD Portfolio
Heidi Livengood's Professional CADD Portfolio
 
Real Smart Art Infographics by Slidesgo.pptx
Real Smart Art Infographics by Slidesgo.pptxReal Smart Art Infographics by Slidesgo.pptx
Real Smart Art Infographics by Slidesgo.pptx
 
如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(ArtEZ毕业证书)ArtEZ艺术学院毕业证成绩单本科硕士学位证留信学历认证
 
Webhost NVME Cloud VPS Hosting1234455678
Webhost NVME Cloud VPS Hosting1234455678Webhost NVME Cloud VPS Hosting1234455678
Webhost NVME Cloud VPS Hosting1234455678
 
Bit Dhrumi shah Graphic Designer portfolio
Bit Dhrumi shah Graphic Designer portfolioBit Dhrumi shah Graphic Designer portfolio
Bit Dhrumi shah Graphic Designer portfolio
 
如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(BC毕业证书)波士顿学院毕业证成绩单本科硕士学位证留信学历认证
 
CADD 141 - Puzzle Cube Project - Product Photos
CADD 141 - Puzzle Cube Project - Product PhotosCADD 141 - Puzzle Cube Project - Product Photos
CADD 141 - Puzzle Cube Project - Product Photos
 
如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UW毕业证书)华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
 
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Bath毕业证书)巴斯大学毕业证成绩单本科硕士学位证留信学历认证
 
Avoid these common UI/UX design mistakes
 Avoid these common UI/UX design mistakes Avoid these common UI/UX design mistakes
Avoid these common UI/UX design mistakes
 
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(Columbia College毕业证书)纽约市哥伦比亚大学毕业证成绩单本科硕士学位证留信学历认证
 
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
一模一样英国德比大学毕业证(derby毕业证书)本科学历-国外大学文凭办理
 
Recycled Modular Low Cost Construction .pdf
Recycled Modular Low Cost Construction .pdfRecycled Modular Low Cost Construction .pdf
Recycled Modular Low Cost Construction .pdf
 
CADD 141 - BIRD Scooter - Cup Holder Photos.pdf
CADD 141 - BIRD Scooter - Cup Holder Photos.pdfCADD 141 - BIRD Scooter - Cup Holder Photos.pdf
CADD 141 - BIRD Scooter - Cup Holder Photos.pdf
 
如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证
如何办理(UCL毕业证书)伦敦大学学院毕业证成绩单本科硕士学位证留信学历认证
 
如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UMN毕业证书)明尼苏达大学毕业证成绩单本科硕士学位证留信学历认证
 
Explaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdf
Explaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdfExplaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdf
Explaining the Hidden Treasures of Modern Bathroom Design — freixadesign.pdf
 
Spring Summer 2026 Inspirations trend book Peclers Paris
Spring Summer 2026 Inspirations trend book Peclers ParisSpring Summer 2026 Inspirations trend book Peclers Paris
Spring Summer 2026 Inspirations trend book Peclers Paris
 
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjjWeek 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
Week 11 Mini-Tasks.pptxjjjjjjjjjjjjjjjjjjjj
 
Onyx Tiles Where Elegance Meets Durability
Onyx Tiles Where Elegance Meets DurabilityOnyx Tiles Where Elegance Meets Durability
Onyx Tiles Where Elegance Meets Durability
 

Database design i_-_1_dl300

  • 1. UU - IT - UDBL 1 DATABASE DESIGN I - 1DL300 Summer 2009 An introductury course on database systems http://user.it.uu.se/~udbl/dbt-sommar09/ alt. http://www.it.uu.se/edu/course/homepage/dbastekn/st09/ Kjell Orsborn Uppsala Database Laboratory Department of Information Technology, Uppsala University, Uppsala, Sweden Kjell Orsborn 8/12/09
  • 2. UU - IT - UDBL 2 Database API:s (Elmasri/Navathe ch. 9) (Padron-McCarthy/Risch ch 20) Kjell Orsborn Department of Information Technology Uppsala University, Uppsala, Sweden Kjell Orsborn 8/12/09
  • 3. UU - IT - UDBL 3 Database user interfaces • Textual interfaces – Such as BSQL for Mimer • Graphical interfaces – Most well-known is QBE (Query-By-Example) originally developed by IBM. MS Access uses a QBE variant. • SQL application programming interfaces – Requires management of sessions, sql statements and some control of query optimization. – Call-level interfaces – Embedded SQL Kjell Orsborn 8/12/09
  • 4. UU - IT - UDBL 4 Call-Level Interfaces • Vendor-specific call-level interfaces – An SQL API usually for one or several host languages like C, C++, Java, Fortan, COBOL etc. – Support to manage sessions, SQL statements and data conversions • SQL Call Level Interface (CLI), – The Call Level Interface (CLI) is a standard SQL API created by The Open Group. The API is defined for C and COBOL only. ISBN: 1-85912-081-4, X/Open Document Number: C451, 1995. • SQL/CLI – Call-Level Interface (SQL/CLI) is an implementation-independent CLI to access SQL databases. SQL/CLI is an ISO standard ISO/IEC 9075-3:1995 Information technology -- Database languages -- SQL -- Part 3: Call-Level Interface (SQL/CLI). The current SQL/CLI effort is adding support for SQL:1999. • ODBC – (Microsoft) Open Database Connectivity is a standard SQL API. ODBC is based on the Call Level Interface (CLI) specifications from SQL, X/Open (now part of The Open Group), and the ISO/IEC. ODBC was created by the SQL Access Group and released Sept, 1992. • JDBC - Java Database Connectivity – JDBC is an SQL API for Java (to be strictly correct, JDBC is not an acronym). Kjell Orsborn 8/12/09
  • 5. UU - IT - UDBL 5 The ODBC architecture • ODBC API is independent of any one programming language, database system or operating system. Kjell Orsborn 8/12/09
  • 6. UU - IT - UDBL 6 The JDBC architecture • JDBC API is independent of (relational) DBMS and operating system Kjell Orsborn 8/12/09
  • 7. UU - IT - UDBL 7 Alt. JDBC architecture (JDBC-ODBC bridge) • Makes ODBC accessible from JDBC such that no special JDBC drivers are required. Kjell Orsborn 8/12/09
  • 8. UU - IT - UDBL 8 Programming with SQL CLI interfaces JDBC example • The JDBC API (Application Program Interface) is a set of Java interfaces that allow database applications to: – open connections to a database, – execute SQL statements, and – process the results. • These include: – java.sql.DriverManager, which loads the specific drivers and supports creating new database connections – java.sql.Connection, which represents a connection to a specific database – java.sql.Statement, which allows the application to execute a SQL statement – java.sql.PreparedStatement, which represents a pre-compiled SQL statement – java.sql.ResultSet, controls access to rows resulting from executing a statement Kjell Orsborn 8/12/09
  • 9. UU - IT - UDBL 9 JDBC example import java.sql.*; public class JDBCExample {    public static void main(String args[]) { String url = "jdbc:mySubprotocol:myDataSource"; Connection con; String query = "SELECT NAME FROM EMPLOYEE WHERE INCOME > 10000"; Statement stmt; try {     Class.forName("myDriver.ClassName"); }catch(java.lang.ClassNotFoundException e) {    System.err.print("ClassNotFoundException: ");    System.err.println(e.getMessage()); } try {     con = DriverManager.getConnection(url, "myLogin", "myPassword");     stmt = con.createStatement();     ResultSet rs = stmt.executeQuery(query);     while (rs.next()) {     String s = rs.getString(”NAME");        System.out.println(s);     }     rs.close();     stmt.close();     con.close(); }catch(SQLException ex) {    System.err.print("SQLException: ");    System.err.println(ex.getMessage()); }}} Kjell Orsborn 8/12/09
  • 10. UU - IT - UDBL 10 JDBC example (prepared statement) import java.sql.*; public class JDBCExample {    public static void main(String args[]) { String url = "jdbc:mySubprotocol:myDataSource"; Connection con; String query = "SELECT NAME FROM EMPLOYEE WHERE INCOME > ?; Int incomeLimit; PreparedStatement stmt; try {     Class.forName("myDriver.ClassName"); }catch(java.lang.ClassNotFoundException e) {    System.err.print("ClassNotFoundException: ");    System.err.println(e.getMessage()); } try {     con = DriverManager.getConnection(url, "myLogin", "myPassword"); stmt = con.prepareStatement(query); while(....) {    .... // Code to read lower income limit into incomeLimit stmt.setInt(1,incomeLimit); ResultSet rs = stmt.executeQuery();     while (rs.next()) {        System.out.println(rs.getString(”NAME"));     }}     rs.close();     stmt.close();     con.close(); }catch(SQLException ex) {    System.err.print("SQLException: ");    System.err.println(ex.getMessage()); }}} Kjell Orsborn 8/12/09
  • 11. UU - IT - UDBL 11 Embedded SQL • Host language include embedded and specially marked SQL statements. • Embedded statements are extracted by preprocessor, translated and replaced by database calls, precompiled (prepared) and stored on server. • The preprocessed application is then compiled normally • Supports dynamic recompilation • Reduces optimization cost and can be somewhat simpler than CLI programming. Kjell Orsborn 8/12/09