1 / 14

Overview

Overview. Class systems poll Microsoft SQL Server Cubist Server CGI Programming JDBC Programming Project Milestones Reminder. Systems Poll. Java or C/C++ ? Perl HTML dynamic HTML: cgi, php, asp, jsp database systems? Mysql, postgresql, MSSQL, …. SQL Server: Query Analyzer.

marisa
Download Presentation

Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview • Class systems poll • Microsoft SQL Server • Cubist Server • CGI Programming • JDBC Programming • Project Milestones Reminder

  2. Systems Poll • Java or C/C++ ? • Perl • HTML • dynamic HTML: cgi, php, asp, jsp • database systems? Mysql, postgresql, MSSQL, …

  3. SQL Server: Query Analyzer

  4. SQL Server: Login

  5. SQL Query Analyzer Interface

  6. Cubist • CGI programs are not allowed by cs web server • Special server: CUBIST • Your account will have directory www • Accessed as • http://cubist.cs.washington.edu/~username/

  7. Cubist (Continue) • You will need to access PostgreSQL on Cubist • Account has been setup for you. • Password should have been emailed to you individually. • Getting start with PostgreSQL details are on our course website.

  8. CGI Programming • CGI: common gateway interface • a program executed by web server, returning web content

  9. Static HTML www.cs.washington.edu/static.html <html> <h1> I love databases! </h1> </html> GET static.html WWW BROWSER WEB SERVER

  10. “Dynamic” HTML w/ PERL www.cs.washington.edu/dynamic.pl #!/usr/bin/perl print “Content-type: text/html \n”; print “<html>\n”; print “<h1> I love databases! </h1> \n”; print “</html>\n”; CGI Program GET dynamic.pl WWW BROWSER WEB SERVER program output

  11. Dynamic HTML w/ DB GET db_access.pl WWW BROWSER WEB SERVER program output query results SQLquery SQL Server

  12. DB connection from perl #!/usr/bin/perl5 -w use CGI; use DBI; $html = new CGI; print $html->header, "\n", $html->start_html(); &searchDatabase; print $html->end_html; • sub searchDatabase • { • $sql = "SELECT * FROM MovieDatabase"; • $db = DBI->connect ("dbi:Pg:dbname=database", "cse444", “cse444"); • $db or die "Sorry we couldn't connect!\n"; • $data = $db->prepare($sql); • $data->execute(); • $tuple = ""; • while ($tuple = $data-> fetchrow_hashref()) { • $title = $tuple->{Title}; • print “Title is $title<p>"; • } • }

  13. Get postgresql.jar from http://jdbc.postgresql.org/ DB Connection from Java • import java.io.*; • import java.util.*; • import java.sql.*; • public classDatabase { • public staticvoidmain () { • try { • Class.forName("org.postgresql.Driver"); • java.sql.Connection con = DriverManager.getConnection (“jdbc:postgresql:database”, “cse444”, “cse444”); • java.sql.Statement stmt = con.createStatement(); • java.sql.ResultSet rs = stmt.executeQuery (“SELECT * FROM MovieDatabase”); • while(rs.next()) { • System.out.println(“Title is ” + rs.getString(“Title”); • } • } • catch (SQLException e) { System.out.println (“Error in database connection”); } • } • }

  14. 1st Project Milestones • Today: Groups formed, email both Alon (alon@cs) and Luna (lunadong@cs) with: • The members of the groups • The group name • The URL of the group web page • Other project milestones details are online.

More Related