ࡱ>    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~RdO)/Pictures PowerPoint Document(SummaryInformation(c )?(  L 8$PersistPerson.java/ 0DArial Monoma`ss& "DArial Blackma`ss&  DTimes New Roman`ss& 0DWingdingsRoman`ss& @DAndale Monoman`ss& PDTimes Monoman`ss& g0.  @n?" dd@  @@``   @         !"#$%&'()*+,-./1203674859:;<=>?@?B$1q>hGh~B$m㉏9֕B$/>^T9X 0e0e     A@ A5% 8c8c     ?1 d0u0@Ty2 NP'p<'pA)BCD|Es " 0e@        @ABC DEEFGHIJK5%LMNOPQRSTUWYZ[ \]^_ `abN E5%  N E5%  N F   5%    !"?N@ABC DEFFGHIJK5%LMNOPQRSTUWYZ[ \]^_ `ab0T!y ],hf׮B1q>hGh~R;<<=̭5xklU-GK)U h (Y1B  "HyJ"QmDF ՖBSRL4$S! gw%f o3w={Lο!SPd%wy8&LLUJ@zE'èj^.ˋEn6!F v 0_ֵvtގFt$`b p7G_=up[pYK澾q ?E=2QQ Er;P量#)e$߉?1&Lq*x@qo"fM9b~>7s$Y̙pDLX\;=5ی59J|a\!œ`l6N؎jfa,q&UFDWF7He0ڸ ##2.M(GoaK1H~z^98GӃFe4:b1Eqa\+Pk\a$hee?-#';VY,<|55'FCiMmGrZu%tJ+5TM۴M۴M۴M۴M۴-d3ת{4*?܍dI)'691_oNɻ~Z`-{\'z w~ǂ#a`C]G.:VPR>V{nZ#Ʒ+N>%d+)'ed3ϿM"yZrU%J82&yFXG64 +1x,8R2@ a%Y(e!3y1*?4^ƪ4"9hQj*{_^41 U $ }U ^\Vj*>QT| M=YT0w)C#Q`aJSP4RSىf٤T> YT8~Qj*{]h*˒Gʉiiiiil~`:mr$J\$#1ɖnIҝgz^%<#ҏU+M<&p[ pِn1$9l1آ ,hR'<,ZқB Q-y+XVIҞdI%ªE`v\'WYEVX'gQ8iEmp)p;rF<,s Eid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0p8$mHp@ pp0___PPT10 00>___PPT9 h___PPT2001D<4X? -O  = ) :Implications of JDO for Java Database Access Architectures;:$FCraig E. Ward May 5, 2004 CMSI 698 Advanced Topics in Database SystemsGGAgendaLIntroduction Motivation Technologies Overview Performance Studies ConclusionJava TechnologiesJava as a programming language Java as a set of standard libraries Java as a set of specifications for special purposes JDBC RMI EJB And more& Java is a lot more than just a programming language. Too many choices?BxZZGZxG MotivationA general question: How do you know which Java technology to use for some problem? A more specific question: Is the new JDO standard an improvement over the existing standards?Technology OverviewsJava Database Connectivity (JDBC) SQLJ Java Data Objects (JDO) Java Servlets Java Server Pages (JSP) Enterprise Java Beans (EJB)Technology OverviewsJDBCSet of interfaces and classes to access a relational database. Encapsulates and hides the details of the location and access methods of a database. A core Java technology used by the others.JDBCJDBC Driver TypesType 1 Bridging technology: JDBC-ODBC Type 2 Uses API native to another language, e.g. C++ Type 3 Network communication to another middleware layer Type 4  Pure Java Communicates with native Java API in database server.2A.2  A JDBC Sample Code JDBC Sample Code SQLJA Call Language Interface (CLI). Not part of the Java  family of standards. Supported by major vendors. Oracle IBM Requires a preprocessor before the Java compiler Also includes stored procedures and user defined objects.<iZ ZkZi k  SQLJ Sample Code! SQLJ Sample Code$JDOJava Data Objects encapsulate the interface to JDBC. Requires a tool to either process the Java source code prior to compilation or to enhance the byte code after compilation. JDO allows Java developers to view data as Java objects.%JDO&JDO Sample Code)JDO Sample Code+ Java ServletsAn alternative to CGI programs. Require a container to execute. Good for dynamic web content. May or may not use database access. Used for presentation layer,Servlet Code Sample.Servlet Sample Code/JSPJava Server Pages are an alternate method of creating Java Servlets. Rather an have Java code output HTML, HTML contains Java code. From the standpoint of the container, there is no difference.0JSP Sample Code3Enterprise Java BeansPart of Java 2 Enterprise Edition. Two types related to databases: Session EJBs Entity EJBs EJBs require at least three files to implement the required pieces: Home Interface Remore Interface Bean Implementation A complex environment.tCZZDZ4ZZCD4>K N54Enterprise Java BeansEntity EJBs represent objects in a database Two ways to manage object persistence: Bean Managed Persistence Container Managed Persistence Configuration is through XML files Container implements the home and remote interfaces A complex system<SZ7ZhZS7h5EJB Sample Code6EJB Sample Code7EJB Sample Code; Rice StudyUsed servlets as a baseline Compare performance Session EJB to Entity EJB with multiple architectures BMP vs. CMP Gauge of complexity of each implementation Servlets ran in Tomcat 3.2.4 EJBs in JBoss 2.4.4 and JOnAS 2.4.4 <fZ ZmZf mPjM =Rice Study ArchitecturesDeveloped a system that modeled an e-commerce site such as eBay Servlets-only Session bean only Session faade BMP EJB CMP EJB <Rice Study Conclusions1Servlets out performed EJB. BMP out performed CMP. The numbers of classes in EJB implementation became harder to manage quickly. The internal architecture of the server was key: JBoss relied heavly on Reflection JOnAS used precomplied bean implementation Testing JBoss with Java 1.3 made little difference*ZZb &>Gorton & Liu 2003Compared Session bean-only and Session faade patterns Used a simulated e-commerce system from Gorton Simulated number of connected users Simulated number of requests Standalone and clustered configurations (were possible) Tested six server products Borland Enterprise Server 5.02 Interstage Application Server 4.0 SilverStream Application Server 3.7.4 WebLogic Server 6.1 WebSphere Application Server 4.0 JBoss 2.4.3. ^fZAZSZZfASA Gorton & Liu 2003 ConclusionsSession-only implementations were faster The Session-faade suffered a performance hit due to extra inter-bean communication in the container.B!"National Climate Data Center StudyProblem of large data sets, Integrated Surface Hourly (ISH) each with 40 elements ISH in a data mart using the star pattern Only study to include JDO Tested Simple streamed file system Key/value database RDBMS (JDBC, EJB and JDO) OODBMSTR*!PR*!PE"NCDC Study ConclusionsThe best overall performance from key/value database The expected number of objects would probably make key/value difficult to manage J2EE with JDO expected to play a role Considered EJB BMP to be deprecated in favor of CMPG#Conclusions & SuggestionPerformance results are just snap-shots in time. What is best still depends on what the problem is and what tools and skills are available. JDO has the advantage of an object-oriented view of data and this should make it more useful in the future. JDO 2.0 just went into final review status end of April 2004. The technology is always changing. A standard benchmark would be useful. $ZZH$ Studies CiteddCecchet, Emmanuel ; Marguerite, Julie and Zwaenepoel, Willy. (2002). Performance and Scalability of EJB Applications. Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications, OOPSLA, 2002, p 246-261 Gorton, Ian and Liu, Anna. (2003). Evaluating the Performance of EJB Components. IEEE Internet Computing, v 7, n 3, May/June, 2003, p 18-23 Baldwin, Richard T. (2003). Views, Objects, and Persistence for Accessing a High Volume Global Data Set. Digest of Papers IEEE Symposium on Mass Storage Systems (MSS 03) p 77-81p3waR%i@ $" I%Questions & Discussion/h"#'( * - 1 2 89:?@CDFsx,, ` e(HH(dh  ` ffff33` 3KIff` 8n` DDyq` ffw` jff3f̙` JyOOw3ff` 3OOw3ff` /p` 3OOw%*|` 33333ff` >?" dd@$?nKd@P nA@F`d n?" dd@   @@``PR    @ ` `*p>>   X (  @  6GH #" ``   p*CMSI 698 Advanced Topics in Database Management Systems99   60IH #" `` `  \* F X "X  TIHd"P D0   <pKHd"U B0   c $KH"UY <   s *AH"YW <    s *BH"YU <    s *PDH" <    c $FH"SV B0    c $CH"Y <    s *pBH"X <   6JH " `  T Click to edit Master title style! !$  0KH " `p  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  6@  #" `^ `  T*May 5, 2004  H  0޽h ? 80___PPT10. 07  PixelE    5(  Z F  "  Zd " D0   s *  "9)e  B0 ^N e  "e   c $` "ie  B0   c $ "9) B0    c $ "0 B0    c $ "?e  B0    c $`") B0    c $ "?G B0    c $"oG B0   c $"9G B0   c $ "iA B0   c $ "A? B0   6@  #" `` `  X*   6 }m #" ``   Z*   6m #" `` `  \*   0 m "P    T Click to edit Master title style! !  0m " P   W#Click to edit Master subtitle style$ $H  0޽h ? 80___PPT10. 07 zr` (    0@q P    P*    00r     R*  d  c $ ?    0r  0  RClick to edit Master text styles Second level Third level Fourth level Fifth level!     S  6r _P   P*    6(r _   R*  H  0޽h ? 3380___PPT10.&48` p (      0P*r P    P*     0p+r     R*     6,r _P   P*     6-r _   R*  H   0޽h ? 3380___PPT10.&4; @(  l  C ЄrP    l  C pr P   H  0޽h ?   (  l  C .r `   l  C .r `p  H  0޽h ?   $( | $l $ C /r `   l $ C P0r `p  H $ 0޽h ?   ((  (l ( C 1r `   l ( C p1r `p  H ( 0޽h ?   ,(  ,l , C 1r `   l , C 02r `p  H , 0޽h ?   @80( TTUUWWXX 0l 0 C `m `   $ 0 C A layers.PIC 001F51A4 Macintosh HD ABA78158: 9 H 0 0޽h ?   @(  @l @ C FH `   l @ C  `p  H @ 0޽h ?   @8<( gd  <l < C  `   $ < C Ajdbc.PIC 001F51A4 Macintosh HD ABA78158:P0 H < 0޽h ?   0H(  Hl H C  `   l H C   `p  H H 0޽h ?   @L( H Ll L C @ `   p L Bs ?C"x0ey       \ ~.Connection connection = null; try { // load the driver Class.forName(args[0]).newInstance(); } catch( Exception e ) { // problem loading driver, class not exist? e.printStackTrace(); return; } try { connection = DriverManager.getConnection(args[1],args[2],args[3]); } catch( SQLException e ) { e.printStackTrace(); } finally { if( connection != null ) { try { connection.close(); } catch( SQLException e ) { e.printStackTrace(); } } } :.0 2.Q U4  k  H L 0޽h ?   `T(  Tl T C u `   s T H ?C"x0ey       j {public void printAccounts(String name) throws SQLException { DataSource ds = null; Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { ds = this.getDataSource(); conn = ds.getConnection(); ps = conn.prepareStatement("select account,ballance from accounts where customer_name = ?"); ps.setString(1,name); rs = ps.executeQuery(); while (rs.next()) { System.out.println (rs.getString("account") + "\t" + rs.getFloat("ballance")); } } catch (Exception e) { System.out.println(e.getMessage()); } finally { if(rs!=null) rs.close(); if(ps!=null) ps.close(); if(conn!=null) conn.close(); } } :0 2  ~    Q   $& +J (H T 0޽h ?   \( TTUUWWXX \l \ C 0  `   l \ C   `p  H \ 0޽h ?   g_`(    `l ` C   `   K ` H ?C"x0ey       r  Stry { #sql { DELETE FROM employee WHERE emp_id = 17 }; } catch (SQLException sqe) { System.out.println (sqe.getMessage()); }$t+ H ` 0޽h ?   h( ,̭ hl h C 0 `   m h B ?C"x0ey       @)  {#sql context EmpContext; String url = "jdbc:sybase:Tds:localhost:2638"; EmpContext empCtxt = new EmpContext(url, "dba", "sql", false); #sql [empCtxt] { DELETE FROM employee WHERE emp_id = 17 };$:     & H h 0޽h ?   l(  ll l C 0 `   l l C  `p  H l 0޽h ?   @8p(  pl p C  `   $ p C Ajdo.PIC 001F51A4 Macintosh HD ABA78158:P0` H p 0޽h ?    xB( d  xl x C  `    x Hp ?C"x0ey       P@.p PersistPerson.java0 2 H x 0޽h ? H   ( | l  C  `     B* ?C"x0ey       p   :0 2  0   - #H  0޽h ?   0( $h: 0 l  C 2 `   l  C p2 `p  H  0޽h ? '   @g(  l  C 3 `     Hp] ?C"x0ey        .? package first; import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.util.*; public class MyServlet extends HttpServlet { public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("

Craig's First Servlet

"); out.println("

hello!

"); out.println(new Date()); } } hku0 2kuV      *H  0޽h ?    `[(  l  C l `     H ?C"x0ey       P  JBlog Simple Servlet Web log Example webmaster cewcew@mac.com The EMAIL address of the administrator to whom questions and comments about this application should be addressed. DBtest Testing Connection to MySQL DBtest :0 2  ^ g AH  0޽h ?   ( L$r l  C ` `   l  C  `p  H  0޽h ? !   a( TTUUWWXX l  C   `     H  ?C"x0ey        d  My First JSP

My First JSP

Hello!

Scriptlet Tag

Can contain one or more valid java statements separated by semi-colons. You can use jsp "implicit objects," i.e. built-in, global objects that have been pre-initialized and instantiated for you.

<% out.println( new java.util.Date() ); %>

Expression Tag

Saves you from typing out.println.

<%= new Date() %>

Page Directive

Usually at the top.

<%@ page import="java.util.*"%> :0 2  } ay CcH  0޽h ?   ( Ѱ 0 l  C # `   l  C P$ `p  H  0޽h ?   ( l l  C p( `   l  C ( `p  H  0޽h ?   ^V( TTUUWWXX l  C ( `   B  H ?C"x0ey       P J package J2EEApp; import javax.ejb.EJBHome; import javax.ejb.CreateException; import java.rmi.RemoteException; public interface BankMgrHome extends EJBHome { public BankMgr create() throws CreateException, RemoteException; } // end class package J2EEApp; import javax.ejb.EJBObject; import java.rmi.RemoteException; public interface BankMgr extends EJBObject { // Returns UserID after validating Username + Password in database public String loginUser(String pUsername, String pPassword) throws RemoteException; // Returns data model object of a Customer public CustomerData getCustomerData(String customerID) throws RemoteException; } // end class 0 2       ,  C   < H  0޽h ?   :( @r  l  C ` `     BƤ ?C"x0ey       P: package J2EEApp; import java.sql.*; import javax.sql.*; import javax.naming.*; import javax.ejb.SessionBean; import javax.ejb.SessionContext; public class BankMgrEJB implements SessionBean { private static final String loginQuery = "SELECT USERID FROM J2EEAPPUSER WHERE USERNAME = ? AND PASSWORD = ?"; private javax.sql.DataSource jdbcFactory; private CustomerHome myCustomerHome; // SessionBean implementation public void ejbActivate() { } public void ejbPassivate() { } public void ejbCreate() { try { Context initialContext = new InitialContext(); jdbcFactory = (DataSource)initialContext.lookup("java:comp/env/jdbc/BankMgrDB"); myCustomerHome = (CustomerHome)initialContext.lookup("customerServer"); } catch (NamingException ne) { System.out.println("NamingException:\n" + ne.getMessage()); } } // Bean methods :0 2       " \          #H  0޽h ? n  (  l  C Ӥ `     H0Ԥ ?C"x0ey       p*  public CustomerData getCustomerData(String customerID) { Customer customer = null; CustomerData cust = null; try { customer = myCustomerHome.findByPrimaryKey(customerID); System.out.println("Got Customer from findByPrimaryKey()"); cust = customer.getCustomerData(); } catch (Exception e) { System.out.println("Bad ID " + customerID + ": " + e); } finally { return cust; } } // getCustomerData :0 2   "   - & H  0޽h ?   0( TTUUWWXX l  C  `   l  C @ `p  H  0޽h ?   @( TTUUWWXX l  C  `   l  C ` `p  H  0޽h ?   `( `' l  C  `   l  C  `p  H  0޽h ?   ( TTUUWWXX l  C   `   l  C P! `  H  0޽h ?   (  T l  C # `   l  C 0& `p  H  0޽h ?   (  l  C ' `   l  C ( `p  H  0޽h ?   ( 2 l  C 0) `   l  C ( `p  H  0޽h ?   (  l  C * `   l  C + `p  H  0޽h ?   (  l  C @ `   l  C  `@  H  0޽h ? d   0(  l  C r `   H  0޽h ?  Q(  R  3      C 0/r 0   _KThe technologies to review will be JDBC, JDO, SQLJ, Servlets, JSP, and EJB.H  0޽h ? 33 P J(   R   3       C 0)r 0   XDThis presentation should accompany the paper written for the class. H   0޽h ? 33 4T(  4R 4 3     4 C @m 0   bNA diagram showing how the technologies we will summarize relate to each other.H 4 0޽h ? 33 8>( TTUUWWXX 8R 8 3     8 C 2r 0   L8These technologies all relate to or use database access.H 8 0޽h ? 339  D(  DR D 3     D C  0   JDBC allows an application to communicate with a database without knowing where it is or what the particulars of communication are.H D 0޽h ? 33  PPD(  PR P 3     P C t 0   R>This code illustrates one way to setup a database connection. Example from Database Programming with JDBC and Java, 2nd Edition by George Reese, O Reilly 2000.H P 0޽h ? 33+  pX{( | XR X 3     X C   0   SThis code illustrates a connection and the retrieval and processing of a ResultSet.I H X 0޽h ? 333  d( r _ dR d 3     d C p 0   YThe SQL code is delimited by the braces. The example is from (Eisenberg and Melton,1998).Z8"H d 0޽h ? 331 t( \p tR t 3     t C P 0   YGraphic illustrating the relationship of JDO between applications and the JDBC interface.O H t 0޽h ? 33 |f( | |R | 3     | C 0 0   tExample from Almaer, 2002.  H | 0޽h ? 33  M(  R  3      C P1 0   [GThis file illustrates part of the mapping of Java objects to databases.H  0޽h ? 33 P9(  R  3      C j 0   GA simple servlet. H  0޽h ? 33? p( aal2ee R  3      C  0   ;This is part of an XML configuration for a servlet web app.$<0+ H  0޽h ? 33 '( TTUUWWXX R  3      C p" 0   5!A simple JSP to display the date.H  0޽h ? 33R  (  R  3      C  0   The example shows the remote and home interfaces of an EJB session bean. The bean implementation will provide methods corresponding to the remote interface.H  0޽h ? 334  (  0` R  3      C  0   \This method is part of the bean implementation and matches a methon in the remote interface.=H  0޽h ? 33 %( TTUUWWXX R  3      C Ӥ 0   3Part of the bean implementationH  0޽h ? 33 tlp(  R  3    r  #  0    H  0޽h ? 33W P( TTUUWWXX R  3      C @ 0   IServlets only uses servlets for presentation, application logic, and database access. Other architectures used servlets only for presentation. Session bean used Session EJBs for database access. The Session faade used session beans as front ends to Entity EJBs. The implementations that used Entity EJBs alternated BMP with CMP.PE 'H  0޽h ? 33 k( aa-ee R  3      C $ 0   y9JBoss and Interstange Application Server did not cluster.$ $H  0޽h ? 33q  1)(  R  3    /  C & 0   JBoss did not have the same level of performance as some commercial products. This may be for the same problem as in the Rice study, over-reliance on Reflection.H  0޽h ? 33" @(    R  3      C ) 0   N:But other studies cited BMP as better performing than CMP!H  0޽h ? 33cxp^RЀ3ÿ lHbP  @AL G@;b `B&V