Oracle Pro Tips, Trends & Technology eNewsletter Pinnacle Publishing http://www.pinnaclepublishing.com Issue 2.13 June 26, 2001 TABLE OF CONTENTS 1) Pop Quiz 2) Did You Know... 3) Oracle Strategy for Java 4) Industry News 5) Answer to the Pop Quiz --------------------------------------------------------- 1) Pop Quiz (answer at the end) --------------------------------------------------------- How do you include a non-printable character in your SQL output? --------------------------------------------------------- 2) Did You Know... --------------------------------------------------------- * that Oracle has released the Oracle9i database? The Oracle9i home page is: http://www.oracle.com/ip/index.html To read the press release, follow the link below: http://www.oracle.com/corporate/press/index.html?781743.html To sign up for Web-based seminars about the product, go to: http://oracle.com/education/oln/index.html?oln_learn9i.html?src=711302&Act=4 To read about the product summary as well as the technical white papers, follow the links below: http://www.oracle.com/ip/deploy/database/oracle9i/collateral/o9i_family_features.pdf To download the trial version of Oracle9i, go to: http://otn.oracle.com/software/products/oracle9i/content.html Be forewarned that the installation files require more than one gigabyte of disk space. So if you have a 56K modem, you may have to wait hours for the download. If you've decided to purchase the product, you can find out more http://www.oracle.com/features/9i/index.html?pricing.html --------------------------------------------------------- 3) Oracle Strategy for Java --------------------------------------------------------- Contributor: Jim Skehill Jim's biography: Jim Skehill has a BSc in Computer Science from the University of Toronto, Canada. He's been programming in C/C++ for 11 years and in Java for four years, mostly in the financial services field. You can reach him at mailto:JSkehill@ProcaseConsulting.com. * * * * * In the last few columns, I've been talking about BC4J, XML, and JSPs with precious little code to show how all this stuff comes together. I hope to remedy that with this column. Again, I'll be referring to the case study of a Web site that provides reviews of hotels, restaurants, and various other attractions in cities around the world. In fact, let us just take some JSP code from this case study, Attraction.jsp, and go through it line by line to illustrate how these technologies come together: 1: 2: <% 3: bean1.initialize(pageContext, " com_globe_gt_GtModule.AttractionReviewView"); // Set Attraction type and city 4: oracle.jbo.RowSet bean1r = bean1.getRowSet(); 5: bean1r.setWhereClauseParam(0, request.getParameter("CityCode")); 6: bean1r.setWhereClauseParam(1, request.getParameter("Attraction")); 7: bean1r.executeQuery(); 8: bean1.setStylesheet("Attraction.xsl"); 9: bean1.render(); 10: %> (Strictly speaking this isn't the complete Attractions.jsp file. But it's most of it. I left out some header information.) Now, lets go through it. Line 1 defines the jsp:usebean tag which is, in fact, the only tag in the file. This tag creates an object of type XmlData, Oracle's workhorse class for converting data in BC4J views to XML. It assigns this object the variable name bean1. Line 2 defines the start of a block of Java code. The block ends at line 10. Line 3 points bean1 to the BC4J view we want to display. It's called AttractionReviewView, and it's in the Module named com_globe_gt_GtModule. Of course, we spent some time before hand-designing this view so that it gave us the exact slice of data we wanted. Lines 4 to 6 set the where clause parameters in the view. This particular BC4J view was defined with the where clause "(CITY=?) AND (ATTRACTION_TYPE = ?)". These lines assign these bind variables from values specified when the URL is called, for example, http://../Attraction.jsp?CityCode=NewYork&Attraction=Hotels Line 7 causes the view to do a fetch from the database. Line 8 assigns the XSL stylesheet -- for instance, a file named AttractionReviewView.xsl converts the XML document to an HTML document. Line 9 prints the HTML document to the client's browser. And that's it. Last column, I mentioned how you want to keep the Java code in a Jsp file to a minimum. The serious Java code is in the various classes called by the Jsp code. In a sense, Jsp code is the glue that binds the BC4J, XML, etc., together. Next column, I'll wrap up this look at BC4J and talk a bit about a brand new Oracle product: Oracle Container for Java (OC4J). --------------------------------------------------------- 4) Industry News --------------------------------------------------------- Oracle remains a leading vendor of database software. Oracle has increased its overall market share in 2000 to about 33 percent. IBM's DB2 is coming on strong, taking second place with around 30 percent. http://www.oracle.com/corporate/press/index.html?749890.html --------------------------------------------------------- 5) Answer to the Pop Quiz --------------------------------------------------------- You can use the SQL CHR function to CHR return the character having the binary value equivalent to a value in the database character set. With this function, you simply need to look up a value's ASCII position, and invoke the function accordingly. The space character has a decimal position of 32, and we can print it using CHR, as shown below: SQL> select '|' || chr(32) || '|' from dual; '|' --- | | --------------------------------------------------------- Well, that's it for this week. I welcome your feedback, input, tips, suggestions, Web sites, and other Oracle- related news. If you send me something, please let me know whether I can use your name with your comments. I apologize in advance if I don't respond personally to each of your questions or suggestions, but I'll get to as many as I can in the eNewsletter if not personally. Garry Chan, Editor Database Architect mailto:GChan@ProcaseConsulting.com This eNewsletter is brought to you compliments of Pinnacle Publishing, Inc. Copyright(c) 2001 http://www.pinnaclepublishing.com All rights reserved.