Struts, JDBC and Data Guard - Oracle Open World Amsterdam - Friday 24th September - Impressions americas cup win 2682133k1

Struts, JDBC and Data Guard – Oracle Open World Amsterdam – Friday 24th September – Impressions

In this post I will tell you about some of the sessions  notably on Struts support in JDeveloper, Java/JDBC support with Oracle 10g and the Data Guard option of the Oracle RDBMS.

I must confess that I enjoyed the two days I spent at this conference much more than I had expected. To some extent this is thanks to a couple of very good or at least very useful sessions I attended. It is also because of the large number of people I ran into that I know from my early or later days at Oracle or have met during presentations, assignments and so on. I enjoyed talking to so many interesting and friendly people.

The one thing I wanted to see most of all – the Paris release of Oracle Warehouse Builder “ I only had a glimpse of at the demo-grounds, just before I ran into David Keene and started another conversation about the here and now and also the then and there. The glimpse was enticing really; the birds eye view of the diagram and the ability to create Data Mining models were all I saw, but those alone are pretty cool. Apparently OWB Paris should be generally available at the end of this year. I am really looking forward to it. See also this presentation.

Note: all presentations I talk about will be available shortly at http://www.oracle.com/openworld/amsterdam/conference/online/oow_amst_presentations.html. or so they say. Also see presentations during other Open World events, such as Melbourne on BI.

Struts Application Development using JDeveloper

Another of Duncan Mills’ presentations, see powerpoint. To be honest, I was somewhat disappointed. In hindsight it is probably because I did not hear much new stuff – which was to be expected really, so it is my own doing. However, I was pleasantly surprised by Duncan’s demo, simple as it may be. He basically demonstrated the creation of a simple application – JSP and Struts – using the Graphical Struts Editor in JDeveloper as well as the WYSIWYG JSP editor. Simple as it was, it was smooth, intuitive and pleasing to the eye. It made me hungry to get going myself again.

Some things I probably should have known already but still worth highlighting:

    • The JSP editor allows you when you add a
      
      

      tag to select a key from any of the resource bundles specified in the struts-config.xml file; very neat!

the option of ‘pre-executing TLD’ has interesting results in the JSP editor: instead of a tag, you see the result of executing/rendering the tag – further enhancing the WYSIWYG experience. Again, I was impressed

  • The ability to both annotate a Struts Pageflow diagram as well as Publish it (to a PNG file) is very good. It makes it worthwhile to invest in the diagrams as form of technical documentation.

Duncan expressed some puzzlement over the recent events in the release process within the Struts team: various 1.2.x releases published and subsequently withdrawn. Struts may have a somewhat unclear future: many important development resources gone over to JSF team. And JSF has substantial overlap with Struts. When JSF really takes off, what need is there for Struts? Well maybe Struts for JSP programmers and JSF for JSF programmers. Oracle will be supporting JSF as controller (ADF Controller?) in JDeveloper in a similar way as they currently support Struts.

Duncan, when asked, mentioned that some form of support for the Spring framework might also be an idea, although there seems to be a lot of overlap with what Oracle is doing with ADF. He also mentioned that ADF support for Hibernate – next to WebServices, ADF BC (pka BC4J), EJB and Oracle Toplink – might be an interesting notion.

Two interesting enhancement requests were put forward by the audience: visual editor for Struts Validator and an Resource Bundle editor – possibly a hierarchical list of Keys (organized per page or category) with leaf nodes per locale. Duncan would jot down the suggestion and think on it.

Future developments already planned in JDeveloper:

    • Better Tiles support
    • Better support for multiple configurations (currently each project can have only one Struts-config)
    • Support for JSF

The UK Open World presentation can be downloaded already.

Java in Oracle 10g: new JDBC Drivers, Oracle server side JVM etc.

Very briefly about this presentation – which did not show very many new things, but was still interesting (by Manh-Kiet Yap). See the ppt from the UK Oracle Open World and the Powerpoint from the Amsterdam Conference.

With Oracle 10g you can call the Java classes loaded in the Oracle JVM in the database Server directly; until now the Java Classes were wrapped in PL/SQL wrappers that you had to call through JDBC from classes outside the database. That meant two type conversions (Java to PL/SQL and PL/SQL to Java) and another two for any return results. This certainly is an improvement. I am not sure by the way whether you need a database connection to invoke Oracle JVM classes – or a special classpath setting. See the associated documentation.

The new Oracle 10.1.2 JDBC Driver contains Connection Caching that is smart enough to perform load balancing between the various database instances in your grid. Of course, you may not have a grid with multiple server instances in which case it won’t help you.

The WebRowset (JSR 114), an extension of the JDBC ResultSet that can directly translate data to and from XML and can also be used disconnected from the DataSource sounds very interesting.

The Oracle 10g JVM is now on JDK 1.4, which is good.

Call outs of the Java classes stored in the database’s JVM to RMI, EJB, JSP/Servlet and WebServices are supported. Consuming Webservices for example is really easy from Java Stored Procedures.

Publishing PL/SQL packages as WebServices is made easy by JDeveloper. However, to deploy such WebServices, you require OC4J 9.0.4 (10g Application Server). PL/SQL WebService deployment currently has a dependency on JDK 1.3 and some proprietary code in the Oracle Application Server. A next release will make use of standard JAX-RPC libraries and will therefore be portable again across application servers. The demo of publishing some PL/SQL procedures as WebService was very good. Details on publish PL/SQL WebServices from JDeveloper are in the Oracle 10g by Example for JDeveloper tutorial. Step by step details on accomplishing the same feat using only OC4J are in this article by Jason Price on OTN. The Oracle Documentation on the subject – both consuming and publishing webservices from the database – is here.

By the way, new to me was the fact that binary data can be made part of WebService messages. The demo I mentioned before published a PL/SQL package with getPicture and setPicture procedures that returned or took BLOB parameters, typically containing GIF images. These could be returned by the WebService published for the PL/SQL package.

Data Guard

The last session I attended was on Oracle Data Guard, presented by Carel Jan Engel; see powerpoint. Data Guard is database functionality, available since 8i, that allows us to set up a stand-by database (or multiple stand-by databases). This database is automatically kept up to date with all transactions in the primary database. The stand-by database can take over the role from the primary database at any time, for example when the primary database experiences media-failure or some other disaster. Data Guard is a standard feature in the Enterprise Edition database.

Data Guard can operate in two modes – or rather you have two kinds of stand-by databases: logical and physical. Physical stand-by databases are a block-for-block copy (identical copy) of the primary database. Physical stand-by databases are “updated� through the database recovery mechanism that continuously applies the redo log sent to the physical stand-by database by the primary database.

Logical Standby Databases are maintained in a more logical manner. This means for example that you can filter on selected data in the primary database, not everything needs to get copied to the standby-database. It can therefore be used to maintain a read-only database for analysis or reporting purposes. A logical stand-by database can be opened in read-only mode even while updates from the primary-database continue to come in. (it may even be possible to open it in read-write mode, but it can be that during that time no application of primary database redo-sql is done). Carel-Jan said he had disappointing experiences with logical standby in 9iR2 and had serious doubts about its stability. He hoped that the 10g release would prove better in that respect.

In comparison with Oracle Streams: Oracle Streams is a heavier burden for the source database as it performs some log-mining and other activities whereas Data Guard simply siphons off and sends out the RedoLog data that is available anyway.

With Data Guard, you can effectively eliminate the singe point of failure from the database setup – although when the primary database goes down, a brief failover period is unavoidable. Data Guard gives you a lot of flexibility – you can easily switch between primary and standby database, allowing various activities on each in turn.

A very important limitation or requirement: all primary and stand-by databases need to be on the exact same version number – down to the last digit – for both Oracle RDBMS and operating system.

Data Guard can be managed largely from a GUI interface, part of the Oracle Enterprise Manager. Carel-Jan however prefers to write Korn Shell scripts instead. He divided the world of IT-professionals in ‘Command-Line Boys’ and ‘GUI Girls’ and clearly professed he wants to be part of the former group. Now I must say that that is where my heart to some extent lies too. But I had just decided to try to use as much of the GUIs and IDEs made available to me to maximize productivity as well as my ability to transfer knowledge on using tools to colleagues and customers. I do not believe we can really maintain the notion that script-editing in VI or Notepad really beats GUIs and IDEs in terms of productivity. So I am afraid I am striving to be ‘a GUI girl’.

Data Guards allows you to specify a fixed delay between primary and stand-by database, for example 4 hours. That basically means that transactions sent to the stand-by database from the primary database are not immediately applied, but withheld for the specified delay time instead. That means that if a human error – delete all records from a table, oops…. – is made, you have 4 hours or whatever your delay is set to, to correct the error. Since during the delay the erroneous change is not yet applied to the stand-by database, you can use the stand-by database to get the data as it should be – for example all rows from the table that was accidentally truncated – export it and import it in the primary database. When the delay period is complete, the delete all rows will be applied to the stand-by database, as will be the import of the rows shortly afterwards.

Carel-Jan shared a best practice experience from one customer site: there they deliberately stopped the stand-by database from applying changes during the day. Only late at night was the stand-by database brought up to par with the primary database. During the day, the organization ran reports on the stand-by database; since all reports ran against the same data- the situation as it existed in the primary database at midnight – the reports could easily be compared with one another as well as with the reports of the previous day – that had run on the data as it existed at midnight the day before as well. Even though the standby database does not apply the Redo SQL from the primary database, it still receives the Redo SQL and retains them locally to use when allowed to do so; therefore, this setup does not mean any data is lost.

One other case – a database needed to be moved from Singapore to The Hague, The Netherlands. Carel-Jan had a full backup shipped on tape by DHL. He prepared the new database from that full backup. Subsequently the latest changes from the Singapore site were applied to the new database, treated as a stand-by database, through Data Guard over a very simple network connection. This method allowed for a very quick switch-over from the Singapore database to the new primary The Hague database.

All presentations for this Oracle Open World conference can be found at: http://www.oracle.com/openworld/archive/amsterdam2004/index.html

2 Comments

  1. Martin Samm October 19, 2004
  2. Lucas Jellema September 26, 2004
  3. Pingback: » Oracle High Availability Concepts July 15, 2005