Database Systems

422 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
422
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Who I am and what we’ll do Course upcoming submittals
  • DB Server, Client App Driver Query Packets Firewall Tunneling client Ssh server
  • scenario sql*Plus invoking login select table_name from user_tables; describe countries; describe locations; select city,country_name from locations inner join countries on locations.country_id = countries.country_id; differences between databases sqlDev database connection database objects explain reports drag and drop format jdev connection editing schema new scema and generate eclipse? XE database login menus graphical queries Additional tools aqua smart draw
  • Database Systems

    1. 1. Introduction To Oracle And Other Earthly Matters Lecture #3 - Feb 5, 2008, in database systems course, Tel Aviv University Presented by Jackie Assa
    2. 2. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    3. 3. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    4. 4. The Forum! <ul><li>Please Join the Forum at: </li></ul><ul><li>http://www.cs.tau.ac.il/system/forums/ </li></ul>
    5. 5. Homework #1 <ul><li>Submission date is 19 Feb. (No late arrivals will be accepted) </li></ul><ul><li>Work should be done in pairs </li></ul><ul><li>Please, please, please, names and ID on the submittals. </li></ul><ul><li>Details in the course forum </li></ul><ul><li>Simple SQL queries on our “hr” database </li></ul><ul><li>Submission will include an answers document and a SQL script with all the queries. Name of the script should be <yourname>.sql (sent as an attachment) </li></ul>
    6. 6. Project <ul><li>Hard work, but real. </li></ul><ul><li>Work in groups of 4 </li></ul><ul><li>Project goal: to tackle and resolve real-life DB related development issues </li></ul><ul><li>One Two stages. </li></ul><ul><li>Most programming language are accepted (Check with me) </li></ul><ul><li>Thinking out of the box will be rewarded </li></ul>
    7. 7. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    8. 8. DB System from lecture #1 Data files Database server (someone else’s C program) Applications “ Two tier database system” connection (ODBC, JDBC)
    9. 9. A core infrastructure
    10. 10. 1,2,3 tiers
    11. 11. Abstractly (DB) system layers may include Application DB infrastructure DB driver transport DB engine Storage
    12. 12. Why (at least 1 reason) DB programmer App programmer DBA Gui designer Tester
    13. 13. Application layer <ul><li>Why should it actually use database? </li></ul><ul><ul><li>Persistence layer </li></ul></ul><ul><ul><li>Access data storage </li></ul></ul><ul><ul><li>Interfacing between systems </li></ul></ul><ul><ul><li>Large volumes </li></ul></ul><ul><ul><li>Scalability </li></ul></ul><ul><ul><li>Redundancy </li></ul></ul>Application DB infrastructure DB driver transport DB engine Storage
    14. 14. Infrastructure layer <ul><li>Goals: </li></ul><ul><ul><li>Database “hiding” </li></ul></ul><ul><ul><li>Schema abstraction </li></ul></ul><ul><ul><li>Encapsulation of db mechanisms </li></ul></ul><ul><ul><li>Reuse </li></ul></ul><ul><li>How: (In two words) </li></ul>Model Abstraction Application DB infrastructure DB driver transport DB engine Storage
    15. 15. DB driver / bridge <ul><li>Used for: </li></ul><ul><ul><li>API for database connectivity </li></ul></ul><ul><ul><li>Protocol converter </li></ul></ul><ul><ul><li>Performance improvements </li></ul></ul><ul><ul><li>Transaction management </li></ul></ul><ul><li>Examples: </li></ul><ul><ul><li>In a minute… </li></ul></ul>Application DB infrastructure DB driver transport DB engine Storage
    16. 16. Transport <ul><li>Mainly TCP but not only </li></ul><ul><li>Secure </li></ul><ul><li>Efficient </li></ul><ul><li>Fast but not fast enough </li></ul>Application DB infrastructure DB driver transport DB engine Storage
    17. 17. DB engine <ul><li>Total management of the DB environment including </li></ul><ul><ul><li>Security </li></ul></ul><ul><ul><li>Scalability (clustering) </li></ul></ul><ul><ul><li>Maintenance </li></ul></ul><ul><ul><li>Fault tolerant (disaster management) </li></ul></ul><ul><ul><li>Monitoring </li></ul></ul><ul><ul><li>Services </li></ul></ul><ul><li>Large DB engines include Microsoft SQL Server, Oracle, SyBase, MySQL, etc. </li></ul>Application DB infrastructure DB driver transport DB engine Storage
    18. 18. DB engine (2) <ul><li>DB engine management includes: </li></ul><ul><ul><li>Databases/Tables/Fields </li></ul></ul><ul><ul><li>Creation/removal/modification/ optimization </li></ul></ul><ul><ul><li>Connections/Users/Roles </li></ul></ul><ul><ul><li>Security/monitoring/logging </li></ul></ul><ul><ul><li>Jobs/Processes/Threads </li></ul></ul><ul><ul><li>Scheduling/balancing/managing </li></ul></ul>
    19. 19. Storage <ul><li>NAS/SAN, Raid and other stuff… (sorry… not in this course) </li></ul>Application DB infrastructure DB driver transport DB engine Storage
    20. 20. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    21. 21. Terms… <ul><li>ODBC </li></ul><ul><li>ADO </li></ul><ul><li>OLE-DB </li></ul><ul><li>DAO </li></ul><ul><li>MDAC/UDA </li></ul><ul><li>JDBC </li></ul><ul><li>ORM </li></ul>
    22. 22. ODBC (Mainly Microsoft) <ul><li>Open Database Connectivity (ODBC) is a widely accepted application “C” programming interface (API) for database access. </li></ul><ul><li>Maximum interoperability </li></ul><ul><li>Expose database capabilities, not supplement them, except: </li></ul><ul><ul><li>File access data </li></ul></ul><ul><ul><li>Cursor lib </li></ul></ul>
    23. 23. ODBC – Example architecture
    24. 24. ODBC <ul><li>Examples of common tasks: </li></ul><ul><ul><li>Selecting a data source and connecting to it. </li></ul></ul><ul><ul><li>Submitting an SQL statement for execution. </li></ul></ul><ul><ul><li>Retrieving results (if any). </li></ul></ul><ul><ul><li>Processing errors. </li></ul></ul><ul><ul><li>Committing or rolling back the transaction enclosing the SQL statement. </li></ul></ul><ul><ul><li>Disconnecting from the data source. </li></ul></ul>
    25. 25. OLE-DB (Microsoft) <ul><li>General COM model describing how applications access data </li></ul><ul><li>Presents a single, consistent means of access to the application </li></ul><ul><li>Uses two models, rowset and binder </li></ul>OLE-DB Interface Consumer / Application Oracle DB Provider DBMS Exchange Excel Microsoft Windows COM My app
    26. 26. OLE-DB models <ul><li>Rowset: </li></ul><ul><li>Binder </li></ul>
    27. 27. ADO (Microsoft) <ul><li>ActiveX Data Objects (ADO) provides consistent, high-performance access to data. </li></ul><ul><li>COM based, provides ease of use, high speed, low memory overhead, and a small disk footprint. </li></ul><ul><li>Actually a simple interface to OLE DB. </li></ul><ul><li>Includes extensions such as: Multidimensional (ADO MD), Remote Data Service (RDS), etc. </li></ul><ul><li>Alas…. Ado.net </li></ul>
    28. 28. Two words about .Net and java <ul><li>Virtual machine </li></ul>
    29. 29. MDAC… UDA <ul><li>UDA (Universal Data Access) and/or MDAC (Microsoft Data Access Components) include (ADO), OLE DB, and (ODBC). </li></ul>
    30. 30. JDBC <ul><li>Java DB connectivity API </li></ul><ul><li>Similar to ODBC </li></ul><ul><li>Why do you need it: </li></ul><ul><ul><li>Pure Java </li></ul></ul><ul><ul><li>Simple API </li></ul></ul><ul><ul><li>Well….Multi-platform </li></ul></ul>
    31. 31. JDBC <ul><li>Supports n-Tier architectures </li></ul><ul><li>Tabular data handling </li></ul><ul><li>SQL but not only SQL </li></ul>
    32. 32. JDBC <ul><li>API includes: </li></ul><ul><ul><li>DriverManager, Connection, Statement, PreparedStatement, CallableStatement, ResultSet, SQLException, DataSource </li></ul></ul><ul><li>JDBC 2.0 includes: </li></ul><ul><ul><li>Transactions, improved connections, and more… </li></ul></ul><ul><li>JDBC Type Driver: </li></ul><ul><ul><li>Type 1 - (JDBC-ODBC Bridge) drivers. </li></ul></ul><ul><ul><li>Type 2 - native API for data access which provide Java wrapper classes </li></ul></ul><ul><ul><li>Type 3 - 100% Java, use vendor independent Net-protocol to access a vendor independent remote listener. This listener converts vendor independent calls to vender dependent ones. </li></ul></ul><ul><ul><li>Type 4 - They are also written in 100% Java and are the most efficient among all driver types. </li></ul></ul>
    33. 33. ORM <ul><li>Object-Relational mapping is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. (wikipedia) </li></ul><ul><li>For example: Hibernate, EJB3.0, JDO </li></ul>
    34. 34. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    35. 35. Welcome to The travels of a query
    36. 36. SSH Application DB infrastructure Db bridge/driver Transport (TCP) DB engine Server Machine Client Machine Standard way Using Tunnel Application DB infrastructure Db bridge/driver DB engine Server Machine Client Machine Tunnel machine (SSH server) proxy Proxy Machine TCP SSH TCP
    37. 37. SSH in TAU Application DB infrastructure Db bridge/driver DB engine Tunnel machine (SSH server) proxy YOUR MACHINE (HOME/LAB) define DB at 127.0.0.1, port 1555 Nova.cs.tau.ac.il Ida.cs.tau.ac.il Port 1521 Tera Term Pro connects to nova and forward local port 1555 to ida port 1521 For more details: http://www.cs.tau.ac.il/faq/ssh_tunnelling.htm
    38. 38. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    39. 39. Products we will be using <ul><li>Oracle database – (express edition) </li></ul><ul><li>SQLDeveloper </li></ul><ul><li>JDeveloper </li></ul><ul><li>Free to download on oracle.com </li></ul><ul><li>More tutorials on http://www.tau.ac.il/~jackassa/db/ </li></ul><ul><ul><li>java programming.pdf </li></ul></ul><ul><ul><li>JDBC.pdf </li></ul></ul><ul><ul><li>program with PLSQL.pdf </li></ul></ul><ul><ul><li>SQL foundamentals I.pdf </li></ul></ul><ul><ul><li>SQL foundamentals II.pdf </li></ul></ul><ul><ul><li>SQL tuning.pdf </li></ul></ul>
    40. 43. Things to contemplate on when connecting… <ul><li>Host </li></ul><ul><li>Port </li></ul><ul><li>SID </li></ul><ul><li>Driver </li></ul><ul><li>Schema </li></ul><ul><li>User </li></ul><ul><li>password </li></ul><ul><li>localhost/plab-156 </li></ul><ul><li>1521 </li></ul><ul><li>xe/taudb/other? </li></ul><ul><li>Thin oracle.jdbc.driver.OracleDriver </li></ul><ul><li>hr/user/system </li></ul><ul><li>? </li></ul>http://www.tau.ac.il/~jackassa/db/cGuide.htm
    41. 44. SQL*plus demo <ul><li>Invoking (TAU): </li></ul><ul><li>Sqlplus </li></ul>http://www.tau.ac.il/~jackassa/db/cGuide.htm
    42. 61. SQLDeveloper demo Invoking (TAU): sqldeveloper
    43. 80. Oracle JDeveloper demo Invoking (in TAU): jdev
    44. 81. Oracle Express Edition (XE) Installation only at home…
    45. 82. XE Database hands-on demo <ul><li>Installation </li></ul><ul><li>Create a user </li></ul><ul><li>Run a script </li></ul><ul><li>Query </li></ul><ul><li>Other database objects </li></ul><ul><li>Administration tasks </li></ul>Similar tutorial can be found in http://st-curriculum.oracle.com/tutorial/DBXETutorial/index.htm
    46. 83. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    47. 84. Additional Notes <ul><li>SQL functions and arithmetic conditions. </li></ul><ul><li>Usage of quotes </li></ul><ul><li>LIKE, SOUNDS LIKE </li></ul><ul><li>Use the Syntax help in Query browser </li></ul><ul><li>DESCRIBE </li></ul><ul><li>Joins </li></ul>
    48. 85. Agenda <ul><li>Bureaucracy… </li></ul><ul><li>Database architecture overview </li></ul><ul><li>Buzzwords </li></ul><ul><li>SSH Tunneling </li></ul><ul><li>Intro to Oracle </li></ul><ul><li>Comments on homework </li></ul><ul><li>(If time permits) Intro to programming </li></ul>
    49. 86. Project Coding Tips <ul><li>Layering </li></ul><ul><li>Encapsulation </li></ul><ul><li>Reuse </li></ul><ul><li>Configuration </li></ul><ul><li>Schema </li></ul><ul><li>Testing </li></ul>
    50. 87. Thank you
    51. 88. database server (Oracle on plab-156)
    52. 89. Client Application (your app)
    53. 90. Driver (Oracle)
    54. 91. Firewall
    55. 92. SSH client (Tera-term)
    56. 93. SSH Server (Nova)

    ×