Saturday, January 31, 2004

WSAD: Creating a "View" in Websphere and DB2

So there I was trying to emulate the functionality of what was a view in the previous Notes version of my application. All the view had to do was list out the eReports from the system by date. Easy:

1. Create a mapping the the STRUTS configuration file for eReportsByDate.
2. Add a "Forward" to this mapping to the view display JSP called /eReports/eReportsByDate.jsp.
3. Create an action command object class to process this mapping called com.spuggy.sampler.eReports.action.viewBydateAction
4. Add this action to the STRUTS configuration.
5. The Action will create a Business Facade Object called eReportManager and call its menthod findAll().
6. The findAll method will create a Data Access Object FindAllEreportsDAO and call the execute function.
7. The execute function will then create a DBBeans object and execute a select statement.
8. The eReportManager will then loop through the result set using another Data Access Object called FindAllEreportsDAORow.
9. When looping around the result set the eReportManager will populate a vector of Data Transfer Objects called EreportsViewDTO.
10. If everything is rosey then eReportManager.findAll() will return the vector of EreportsViewDTOs back to the Action (see 5).
11. The Action will then shove the EreportsViewDTO back into the request object like so - request.setAttribute("eReportVectorDTO", eReportsVector).
12. Then the action object will use the forward mapping to send the user onto the correct JSP page to display the vector of the results.
13. In the JSP Page the STRUTS logic tag library will be used to iterate over the vector of DTO objects: <logic:iterate id="eReport" name="eReportVectorDTO">.
14 Finally open the URL (all *.do URLs are mapped to the main ActionServelt of STRUTS) and voila the table of eReports appears.


Then you go and refresh the page and the second viewing won't work giving a 500 error. Looking at the server test environment console you see:

[IBM][CLI Driver][DB2/NT] SQL0405N  The numeric literal "0" is not valid
because its value is out of range. SQLSTATE=42820

Then you go and search Google's Websphere Newsgroups for that string and after a bit of clicking around find:

To answer my own question, I have since found out that the cache is
broken in certain scenarios and that IBM are aware of it.

If your SQL contains the following...
where n = the number of rows you want returned, the cache attempts to
replace n with a ? parameter.
When the statement is executed a second time, it expects to be passed
a number as you would do with any other ? substitution. It doesn't get
one so substitutes it with 0, which then causes the statement to fail.

Good eh!!

So then you back into WSAD and alter the Prepared Statement Cache size to 0 on the Datasource
configuration in the test server configuration. Then it finally works.

After that you think, now I need to do the forward and back links and you realise that DB2 does not support MYSQL's Limit function, so you have to do some jiggery-pokery with a second sorted column and passing url strings.

Finally after powering down for the day you have a little think and wonder: "How did all this catch on?"

Thursday, January 29, 2004

J2ME: It's a woolly wireless world out there

I went to a Wireless groover love-in at a secret location in London last night. Wow what an eye-opener. Lots of fascinating stuff about over-the-air provisioning, J2ME, Bulk SMS, Mobile domains, WAP Push, WAP Pull; not to mention the Locomotion, the mashed potato and hand-jive.

It wouldn't be an exaggeration to say that I felt like a stone-age man walking into Los Angeles. As Manuel would say "Ahh no naathing".

Wednesday, January 28, 2004

Monkey Programmer Boy: Trapped in castle grey skull ...

Trapped in castle grey skull, fixing notes client applications for the Hooded Claw. If only the Ant Hill mob would arrive. Hey-yelp! Hey-yelp!

Monday, January 26, 2004

Monkey Programmer Boy: A Fixin' Those Old Notes Apps Blues

Yes, we're fixin' them old Notes applications.

This page is powered by Blogger. Isn't yours?