cs411-proj-dbprogramming

cs411-proj-dbprogramming - CS411 Introduction to Database...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS411 Introduction to Database Programming Mark Overholt
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements Homework #1 Due Tonight! 11:59pm on Compass! Project Track 1 :if you still need a project group or that your group still needs more people, please let Hanna know ASAP . We'll send out your group assignment by Friday. Group assignment is first come first serve. So, email Hanna the following information: – If you still need a project group; or – If your group needs more people, indicate the number of people needed. There are 6 Feedback questions regarding this status of this class. PLEASE respond to these survey questions, so that we may improve the class. https://agora.cs.illinois.edu/display/cs411sp11/Feedback 2
Background image of page 2
Today‟s Objectives • Quick overview of the Projects server and cPanel – Logging in – Transferring Files to your Server – Creating Databases and DB Users – PHPMyAdmin • DB Programming – Using SQL in PHP – Using SQL in Java – Using Stored Procedures 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
cPanel • Everyone should have access to the projects.cs.illinois.edu server for their project. – If you don‟t…let us know!! • Demo of cPanel – Logging on - http://accounts.cs.illinois.edu/projects/ – Adding/Modifying Files – Adding DB – Adding User – PHPMyAdmin 4
Background image of page 4
5 DB Programming •SQL is a very high-level language. Not intended for general-purpose computations. •Solutions: •Outside DBMS: use SQL together with general- purpose programming languages. •Inside DBMS: augment SQL with constructs from general-purpose programming languages.
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 All these methods follow the same basic paradigm 1. Connect to a DB server. 2. Say what database you want to use. 3. Assemble a string containing an SQL statement. 4. Get the DBMS to prepare a plan for executing the statement. 5. Execute the statement. 6. Extract the results into variables in the local programming language.
Background image of page 6
7 Database specific API • Designed and implemented by the DBMS vendor for a specific programming language. • We will go over MySQL API for PHP.
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Connection mysql_connect opens a connection to the DBMS. It gets the DBMS and login information and returns a connection resource. The connection resource is used in future calls. mysql_select_db selects the desired database mysql_close closes the connection at the end. It is called automatically at the end of the script.
Background image of page 8
Connection Example in PHP $username = “USERNAME”; $password = “PASSWORD”; $host = “localhost”; $dbname = “DatabaseName”; $connect = mysql_connect($host, $username, $password); mysql_select_db($dbname, $connect); //Do Stuff with the DB Connection mysql_close($connect); 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 Executing Statements • mysql_query(S, C) causes the SQL statement represented by S to be executed on connection C. • We can detect DBMS initiated errors using mysql_error().
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 51

cs411-proj-dbprogramming - CS411 Introduction to Database...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online