cli-jdbc-php - DatabaseConnection Libraries...

Info icon This preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Database-Connection  Libraries Call-Level Interface Java Database Connectivity PHP
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 An Aside : SQL Injection SQL queries are often constructed by  programs. These queries may take constants from  user input. Careless code can allow rather  unexpected queries to be constructed  and executed.
Image of page 2
3 Example : SQL Injection Relation  Accounts(name, passwd, acct) . Web interface : get name and password  from user, store in strings  n   and  p , issue  query, display account number. SELECT acct FROM Accounts WHERE name = :n AND passwd = :p
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 User  (Who Is Not Bill Gates)  Types Name: Password: Your account number is 1234-567 gates’ -- who cares? Comment in Oracle
Image of page 4
5 The Query Executed SELECT acct FROM Accounts WHERE name = ’ gates’ -- All treated as a comment
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 Host/SQL Interfaces Via  Libraries The third approach to connecting  databases to conventional languages  is to use library calls. 1. C + CLI 2. Java + JDBC 3. PHP + PEAR/DB
Image of page 6
7 Three-Tier Architecture A common environment for using a  database has three tiers of  processors: 1. Web servers  --- talk to the user. 2. Application servers  --- execute the  business logic. 3. Database servers  --- get what the app  servers need from the database.
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8 Example : Amazon Database holds the information about  products, customers, etc. Business logic includes things like “what  do I do after someone clicks  ‘checkout’?” Answer : Show the “how will you pay for  this?” screen.
Image of page 8
9 Environments, Connections,  Queries The database is, in many DB-access  languages, an  environment . Database servers maintain some number  of  connections , so app servers can ask  queries or perform modifications. The app server issues  statements  :  queries and modifications, usually.
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
10 Diagram to Remember Environment Connection Statement
Image of page 10
11 SQL/CLI Instead of using a preprocessor (as in  embedded SQL), we can use a library  of functions. The library for C is called SQL/CLI = “ Call- Level Interface .” Embedded SQL’s preprocessor will  translate the EXEC SQL … statements into  CLI or similar calls, anyway.
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
12 Data Structures C connects to the database by structs  of the following types: 1. Environments   : represent the DBMS  installation. 2. Connections  : logins to the database. 3. Statements  : SQL statements to be  passed to a connection.
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern