Java + XML. Java 2 Enterprise Edition Server Side java Servlets JSP JavaBeans Web Services Database jdbc.

Slides:



Advertisements
Similar presentations
Introduction to JDBC Standard framework for dealing with tabular and generally, relational data SQL (Structured Query Language) is standardized language.
Advertisements

Distributed Application Development B. Ramamurthy.
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
1 JDBC: Part I Attribution These slides are based on three primary sources: –Sun JDBC Tutorial URL: jdbc/TOC.htmlhttp://java.sun.com/docs/books/tutorial/
JDBC Overview Autumn 2001 Lecturer: C. DeJong. Relational Databases widespread use used via SQL (Structured Query Language) freely available powerful.
1 Lecture 29 More on JDBC Overview  Objectives of this lecture  JDBC and its Drivers  Connecting to Databases (Java’s Connection class)  Querying a.
EmbeddedSQL: 1 Impedance Mismatch Problem Problem : How to connect SQL statements with conventional programming languages Different models of language.
CSE470 Software Engineering Fall Database Access through Java.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Three-Tier Architecture Oracle DB Server Apache Tomcat App Server Microsoft Internet Explorer HTML Tuples HTTP Requests JDBC Requests Java Server Pages.
JDBC Java API for Database Connectivity. Layout of this recitation Introduction to JDBC API JDBC Architecture Understanding the design of JDBC API –Classes.
UFCE4Y UFCE4Y-20-3 Components and Services Julia Dawson.
Proposed Website By Raymond Chieng and Tim. This website design is based on a local Chinese restaurant which basically need to facilitate online ordering.
JDBC / ODBC JDBC is the java API that facilitate interaction of a java application with the DBMS. FIRST APPROACH:
Introduction to JDBC (Java Database Connectivity).
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam.
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
Java Database Connectivity (JDBC) Francisco Pajaro Saul Acosta Nahum Quezada Manuel Rubio.
Think Possibility Integrating Web Applications With Databases.
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
Helena Pomezná, ciz034 St. skupina: L392 FEI, VŠB-TUO Ak. rok. 2002/2003 Download:
Database Management Systems 1 Oracle Programming.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java/jsp program to connect to any database.
© Wang Bin 2004 JDBC ----Java Database Connectivity.
CSE470 Software Engineering Fall Database Access through Java.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Java Database Connectivity ASE. Java Database Connectivity (JDBC) l JDBC – provides an interface to Relational Data Sources l JDBC library provides the.
JDBC. JDBC Drivers JDBC is an alternative to ODBC and ADO that provides database access to programs written in Java.
Designing and Developing WS B. Ramamurthy. Plans We will examine the resources available for development of JAX-WS based web services. We need an IDE,
Introduction to JDBC Michelle Lee, Ye Wu & Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
JDBC. JDBC stands for Java Data Base Connectivity. JDBC is different from ODBC in that – JDBC is written in Java (hence is platform independent, object.
JDBC. Preliminaries Database Database Collection of data Collection of data DBMS DBMS Database management system Database management system Stores and.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Chapter 8 Databases.
COMP201 Java Programming Topic 15: Database Connectivity JDBC Reading: Chapter 4, Volume 2.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
JDBC Establish a connection with a database or access any tabular data source Send SQL statements Process the results Two major sets of interfaces: JDBC.
Java Database Connectivity. Java and the database Database is used to store data. It is also known as persistent storage as the data is stored and can.
Copyright © 2002 ProsoftTraining. All rights reserved. JavaServer Pages.
JDBC CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
Session 30 Basics of JDBC. Java Simplified / Session 30 / 2 of 33 Review A Swing menu consists of a menubar, menuitems and menus. Trees are used to depict.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Java and Databases. JDBC Architecture Java Application JDBC API Data Base Drivers AccessSQL Server DB2InformixMySQLSybase.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Java JDBC API. A Java API To Access almost any kind of tabular data To Access almost any kind of tabular data Trademarked (not an acronym) Trademarked.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Basics of JDBC.
1 JDBC: Part II Road Map Using Prepared Statements –Statements v. Prepared Statements –Using Prepared Statements Database Joins Using Database Transactions.
Basics of JDBC Session 14.
JDBC Java DataBase Connectivity. Loading the driver import java.sql.*... Class.forName("org.postgresql.Driver")‏
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Java Database Connectivity.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
6-1 JAVA DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Lec - 14.
Reflection API, JDBC, Hibernate, RMI
JDBC & Servlet CSE 4504/6504 Lab.
JAVA Connection The following uses a ‘bridge’ between Java Database Connectivity (JDBC) and ODBC, namely sun.jdbc.odbc.JdbcOdbcDriver Supplied with the.
Advanced Web Automation Using Selenium
HW#4 Making Simple BBS Using JDBC
Design and Implementation of Software for the Web
Mr. Harish Sharma Asst. Professor Dept. of CA & IT SGRRITS Dehradun
JDBC – ODBC DRIVERS.
Siddhesh Bhobe Persistent eBusiness Solutions
Presentation transcript:

Java + XML

Java 2 Enterprise Edition Server Side java Servlets JSP JavaBeans Web Services Database jdbc

Database Access - JDBC JDBC is a Java API for executing SQL statements JDBC is not an acronym but… “Java DataBase Connectivity” sounds good enough

What Does JDBC Do? Establish a connection with a database Send SQL statements Process the result

Basic Example Connection con = DriverManager.getConnection( “jdbc:odbc:myDNS”,”myLogin”,”myPass”); Statement stm = con.createStatement(); ResultSet rs = stm.executeQuery(“SELECT * FROM myTable”); while (rs.next()) { int i = getInt(“id”); int n = getString(“name”); }

JDBC Two-tier Model DBMS Java Application JDBC Client Machine DBMS - protocol Database server

JDBC Three-tier Model DBMS Application Server (Java) JDBC Server Machine DBMS - proprientary protocol Database server Java Applet or HTML browser HTTP,RMI,CORBA, or other calls Client machine(GUI)

Using JDBC APIs Before Using JDBC: Install Java and JDBC on your machine Install a driver on your machine Install your DBMS

Loading Drivers Loading the driver or drivers you want to use is very simple and involves just one line of code. If, for example, you want to use the JDBC-ODBC Bridge driver, the following code will load it: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Making the Connection The second step in establishing a connection is to have the appropriate driver connect to the DBMS. The following line of code illustrates the general idea: Connection con = DriverManager.getConnection(“url”, "myLogin", "myPassword"); The Url is : “jdbc:odbc:yourdsn”

Creating JDBC Statement Statement stmt = con.createStatement(); At this point stmt exists, but it does not have an SQL statement to pass on to the DBMS. We need to supply that to the method we use to execute stmt. stmt.executeUpdate("CREATE TABLE COFFEES "+ "(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " + "SALES INTEGER, TOTAL INTEGER)");

Updating Tables String updateString = "UPDATE COFFEES SET SALES = 75 WHERE COF_NAME " + " LIKE 'Colombian'"; stmt.executeUpdate(updateString);

Using Queries String query = "SELECT COF_NAME, SALES FROM COFFEES "+"WHERE COF_NAME LIKE 'Colombian'"; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String s = rs.getString("COF_NAME"); int n = rs.getInt("SALES"); System.out.println(n + " pounds of " + s + " sold this week."); }

Writing XML with Java Create A new File OutputStream fout= new FileOutputStream("fibonacci.xml"); Add Buffering OutputStream bout= new BufferedOutputStream(fout); Create Writer OutputStreamWriter out=new OutputStreamWriter(bout, "8859_1");

Writing XML with Java out.write("<?xml version=\"1.0\" "); out.write("encoding=\"ISO \"?>\r\n"); ….. out.flush(); out.close();

Using A Web Service General Service Any Platform Based On HTTP (SOAP) Example: aspplus/samples/services/MathService/VB /MathService.asmx

Using SAX SAX – Simple API for XML Based on interface implementations Parser class extends DefaultHandler Functions: startDocument endDocument startElement endElement characters

Parser SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); saxParser.parse( new File(argv[0]), handler);