|
|
|||||
|
|
|||||
|
|
Slideshow Demo - Java Installation Installation Requirements for Java version In order to use the Java version of the slide show demo, you must install the following: - JRun, a trial version can be found here: http://www.macromedia.com/software/jrun/trial/ - Google’s Java web services classes, which can be found at http://www.google.com/apis/. - Sun’s CachedRowSet. A good article explaining this class, plus instructions for downloading it can be found at http://developer.java.sun.com/developer/technicalArticles/javaserverpages/cachedrowset/ - slidesBean.class, which is the custom java bean written for this demo. You can get the source code for that here. You will need to compile it and put the class file in your {jrun4 path}/servers/lib directory. - You will also need to create a resource using the JRun Administrator to create a JDBC connection pool. We have included a Microsoft Access database. Unzipping the Demo Source Files The demo files should be unzipped into a folder at [webroot]/slideshowDemo/. The Access file can be moved to another location. The slidesBean.java file should be placed in your ClassPath. Why are we using Sun’s CachedRowSet? This demo is using a Flash data structure called a RecordSet that contains a three-column list of results from the database query. Since the Flash Remoting documentation discusses the use of RecordSets in detail, we felt that it was the correct data type to try to use for these presentations. According to the Flash Remoting documentation, in order to automatically populate a Flash RecordSet with the result of a SQL query, you should return your results from Java using a java.sql.ResultSet. This is an extremely common class for dealing with database information. The problem we have found with using a java.sql.ResultSet is that it requires the database connection to be left open. This is not a good idea since your application server will be left with many open database connections. To attempt to get around this problem, we are using a sun.jdbc.rowset.CachedRowSet, which holds a ResultSet independently of the originating connection. However, using the CachedRowSet, we noticed that the FlashRemoting gateway, when converting the CachedRowSet to a RecordSet, does not add on a few properties. This results in what appears to be a harmless message being written to the log. We (and we believe Macromedia) are still learning the best way to implement this in Java. As we discover better ways, we will post there on the MMBUG blog. How to avoid this issue altogether If you wish to avoid this issue with ResultSets altogether, we would suggest using Java ArrayLists, and then manually parse them into RecordSets, or just leave them as Arrays in Flash. These work quickly and cleanly. |