Applets, RMI, JDBC Exam Review



Similar documents
Japan Communication India Skill Development Center

Java the UML Way: Integrating Object-Oriented Design and Programming

CS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University

Japan Communication India Skill Development Center

Fundamentals of Java Programming

An Overview of Java. overview-1

Japan Communication India Skill Development Center

Japan Communication India Skill Development Center

IT6503 WEB PROGRAMMING. Unit-I

COMMUNITY COLLEGE OF CITY UNIVERSITY CITY UNIVERSITY OF HONG KONG

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

SE 450 Object-Oriented Software Development. Requirements. Topics. Textbooks. Prerequisite: CSC 416

The JAVA Way: JDBC and SQLJ

Syllabus for CS 134 Java Programming

Java Application Developer Certificate Program Competencies

COM 440 Distributed Systems Project List Summary

COSC344 Database Theory and Applications. Java and SQL. Lecture 12

Specialized Programme on Web Application Development using Open Source Tools

How To Use A Sas Server On A Java Computer Or A Java.Net Computer (Sas) On A Microsoft Microsoft Server (Sasa) On An Ipo (Sauge) Or A Microsas (Sask

Java SE 7 Programming

Web Pages. Static Web Pages SHTML

Java (12 Weeks) Introduction to Java Programming Language

Building Web Applications, Servlets, JSP and JDBC

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language:

Specialized Programme on Web Application Development using Open Source Tools

1. Overview of the Java Language

An Introduction to Application Security in J2EE Environments

CS 209 Programming in Java #1

Core Java+ J2EE+Struts+Hibernate+Spring

CS/CE 2336 Computer Science II

Java Thin-Client Programming for a Network Computing Environment

Java SE 7 Programming

Java SE 7 Programming

Web Application Architecture (based J2EE 1.4 Tutorial)

Elements of Advanced Java Programming

Java EE Web Development Course Program

IBM Rational Web Developer for WebSphere Software Version 6.0

CSC 551: Web Programming. Spring 2004

CSI 2132 Lab 8. Outline. Web Programming JSP 23/03/2012

Java and Databases. COMP514 Distributed Information Systems. Java Database Connectivity. Standards and utilities. Java and Databases

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

Java SE 8 Programming

Java Server Pages and Java Beans

core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

Enterprise Java. Where, How, When (and When Not) to Apply Java in Client/Server Business Environments. Jeffrey Savit Sean Wilcox Bhuvana Jayaraman

Java applets. SwIG Jing He

DEVELOPING MULTITHREADED DATABASE APPLICATION USING JAVA TOOLS AND ORACLE DATABASE MANAGEMENT SYSTEM IN INTRANET ENVIRONMENT

JAVA r VOLUME II-ADVANCED FEATURES. e^i v it;

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Chapter 9 Java and SQL. Wang Yang wyang@njnet.edu.cn

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Java and J2EE (SCJA Exam CX ) 50 Cragwood Rd, Suite 350 South Plainfield, NJ 07080

Java Web Services Developer Pack. Copyright 2003 David A. Wilson. All rights reserved.

What Perl Programmers Should Know About Java

Web Development in Java

JAVA ENTERPRISE IN A NUTSHELL. Jim Farley and William Crawford. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo.

Virtual Credit Card Processing System

A Java-based system support for distributed applications on the Internet

Efficiency of Web Based SAX XML Distributed Processing

Extreme Java G Session 3 Main Theme Java Core Technologies (Part I) Dr. Jean-Claude Franchitti

NetBeans IDE Field Guide

Building Java Servlets with Oracle JDeveloper

Crystal Reports for Eclipse

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

A Generic Database Web Service

JAVA. EXAMPLES IN A NUTSHELL. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo. Third Edition.

CrownPeak Java Web Hosting. Version 0.20

Applications of JAVA programming language to database management

@ - Internal # - Online TH PR OR TW TOTAL HOURS # @ 175

DIPLOMADO DE JAVA - OCA

HP OO 10.X - SiteScope Monitoring Templates

Tutorial 5: Developing Java applications

Glassfish, JAVA EE, Servlets, JSP, EJB

"New Java course material and available pool of.ppt presentations"

WIRIS quizzes web services Getting started with PHP and Java

Supplement IV.D: Tutorial for MS Access. For Introduction to Java Programming By Y. Daniel Liang

Java - gently. Originaux. Prérequis. Objectifs

Technical White Paper The Excel Reporting Solution for Java

Software Architecture

Lecture 10 Fundamentals of GAE Development. Cloud Application Development (SE808, School of Software, Sun Yat-Sen University) Yabo (Arber) Xu

zen Platform technical white paper

Apache OFBiz Advanced Framework Training Video Transcription

Developing Web Services with Eclipse and Open Source. Claire Rogers Developer Resources and Partner Enablement, HP February, 2004

Building Applications with Protégé: An Overview. Protégé Conference July 23, 2006

Enterprise Application Development In Java with AJAX and ORM

CatDV Pro Workgroup Serve r

Architecture Design For Web-based Application Systems. Instructor: Dr. Jerry Gao Class: CMPE296U

Mobile and Web Applications Developer Track

TYLER JUNIOR COLLEGE School of Continuing Studies 1530 SSW Loop 323 Tyler, TX

IBM Rational Rapid Developer Components & Web Services

Pathways to Digital Employment

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET)

Mastering Tomcat Development

Transcription:

Applets, RMI, JDBC Exam Review Sara Sprenkle Announcements Quiz today Project 2 due tomorrow Exam on Thursday Web programming CPM and servlets vs JSPs Sara Sprenkle - CISC370 2 1

Division of Labor Java Classes (Model) JSP Display results, light processing DataStore Java Servlets heavy lifting, computation Sara Sprenkle - CISC370 3 Web App Programming Error Why do I think this web application is written in Java? Sara Sprenkle - CISC370 4 2

J2SE Remember from the first class? Sara Sprenkle - CISC370 5 What We Have Done Sara Sprenkle - CISC370 6 3

Applets Like servlets,, but on the client-side ( application-( side ) Deployed on the web Pulls code down from the server on to your machine Can be slow Can be displayed in an HTML page, embedded in <applet> tags Used to provide functions in a web page that require more interactivity or animation than HTML graphical game, complex editing, or interactive data visualization Issues with different web browsers Sara Sprenkle - CISC370 7 Applets Way cool for specific uses Graphics/animation on the web Security issues, running someone else s s code on your machine? Run in an sandbox Sun s FAQ: http://java.sun.com/sfaq/ Example applets online Example applets online http://www.anfyteam.com/anj/index.html http://www.aharef.info/static/htmlgraph/ Do a search for your own! Java Web Start - deploy applications Sara Sprenkle - CISC370 8 4

Creating applets Create applets by extending java.awt awt.applet class or java.swing.japplet is subclass of java.awt awt.applet Subclass of Panel Find tutorials online http://java.sun.com/docs/books/tutorial/deployme nt/applet/ Sara Sprenkle - CISC370 9 JDBC: Java Database ase Connectivity Database-independent connectivity Connect to database Get information from database Update data in database Classes in java.sql sql.* package In Java, two steps Establish a connection with a database Execute queries, statements against database Sara Sprenkle - CISC370 10 5

JDBC: Creating a Connection Load the DB driver Classes/library used to connect to the database Specific to the type of database Load the class by name Class.forName("sun.jdbc.odbc.JdbcOdbcDriver ); Create the connection (see API for all ways) Type of DB Location of DB, port DB name String url = jdbc:mysql://localhost:3306/masplasdb"; Connection con = DriverManager.getConnection(url, loginname, password); Need to close connection when done con.close() Sara Sprenkle - CISC370 11 JDBC: Executing Queries: Statements Statement stmt = con.createstatement createstatement(); executequery(string query) Returns a ResultSet Iterate through ResultSet,, row-by-row, getting results from each column stmt.executequery executequery( SELECT * FROM COFFEES ); executeupdate(string query) to update table Returns an integer representing the number of affected rows or 0 for SQL statements that don t execute anything Sara Sprenkle - CISC370 12 6

JDBC: Prepared Statements preparestatement(string template) Compile SQL statement templates Reuse statement, passing in parameters Java handles formatting of Strings, etc. as parameters updatesales = con.preparestatement( "UPDATE COFFEES SET SALES =? WHERE COF_NAME LIKE?"); Set parameters Parameters updatesales.setint(1, 100); updatesales.setstring(2, French Roast ); Sara Sprenkle - CISC370 13 JDBC API Documentation: java.sql sql.* Statements, Connections, ResultSets,, etc. are all Interfaces Driver/Library implements interfaces for its database Limitations Java doesn t compile the SQL statements Exact syntax depends on DB Compile,, run, verify queries outside of Java for your database Then copy and use in Java code Sara Sprenkle - CISC370 14 7

Distributed Programming Two primary ways to communicate Message passing (servlets( servlets,, web services) Remote method calls an object on one computer calls methods of an object on a different computer method call looks like a method call on a local object Remote Method Invocation (RMI) Sara Sprenkle - CISC370 15 Java RMI: Remote Method Invocation Lookup an object by name Client Object location registry Naming service Bind object to a name RMI Invoke methods on object stubs Appears as calling method on local objects Server Objects that implement java.rmi.remote Sara Sprenkle - CISC370 16 8

Why Java RMI? Write distributed programs Distributed games Distributed locks to coordinate multiple machines RMI automates a lot of process Does not require network programming, sockets Sara Sprenkle - CISC370 17 Ant Java-based build tool Like Java make files without make s s wrinkles Works cross-platform Some IDEs use ant to compile projects NetBeans Sara Sprenkle - CISC370 18 9

Ant Configuration files: written in XML <project name="dspace" default="compile"> <target name="compile" description="compile the source code"> <mkdir dir="build/classes"/> <javac srcdir="src" destdir="build/classes" debug="on"> <include name="**/*.java"/> <classpath refid="build.class.path"/> </javac> </target> </project> http://ant.apache.org/ Sara Sprenkle - CISC370 19 Exam Review All topics from the semester Know what we did Know how/when to apply/use Review quizzes for example questions Probably no fill in the blank questions Know content from those questions Sara Sprenkle - CISC370 20 10

Topics Java fundamentals als OOP Javadoc Inheritance Polymorphism Abstract classes Interfaces Exceptions I/O Streams Serialization Compression Cloning Collections Inner Classes GUIs Swing, AWT Components Event Handling Design Regular Expressions JUnit Threads, Synchronization Network Programming XML Web Programming Sara Sprenkle - CISC370 21 Using Java JDK JRE Java libraries CLASSPATH Sara Sprenkle - CISC370 22 11

Using Java When to extend a class When to implement an interface When to use a class Sara Sprenkle - CISC370 23 Object-oriented Programming Objects and primitives Data encapsulation Access modifiers Mutable/immutable objects Sara Sprenkle - CISC370 24 12

In C++, the following function swaps any two values passed: template<class T> void swap (T& a, T& b) { T tmp = a; a = b; b = tmp; } In Java, the following version of the method has no effect on the two values passed: public static void swap (Object a, Object b) { Object tmp = a; a = b; b = tmp; } Even though all object variables in Java are actually references, explain why the Java version of swap does not work. Sara Sprenkle - CISC370 25 13