|
Just to amplify slightly on ttufankj's answer, change the last two lines to:
rcdWLMLOGIN.setField("LSTACCDAT", bdLstAccDate).toBigDecimal();
rcdWLMLOGIN.setField("LSTACCTIM", bdLstAccTime).toBigDecimal();
The setField method doesn't handle com.ibm.math.BigDecimal objects.
HTH,
Gary
> -----Original Message-----
> From: java400-l-bounces@xxxxxxxxxxxx
> [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of MEvans@xxxxxxxxxx
> Sent: Monday, May 12, 2003 10:42 AM
> To: java400-l@xxxxxxxxxxxx
> Subject:
>
>
> I'm having a problem updating a 8s0 field in an AS400 DB2
> database using RLA via the JTOpen Toolbox. I get a
> ClassCastException when the last two lines of code execute.
>
>
> Below is a snippet of the code.
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------
>
> //Develop the file.
> // Create a record format instance for WLMLOGIN.
> RecordFormat[] fmtWFMLOGIN = (new
> AS400FileRecordDescription(as400,
> "/QSYS.LIB/GBTINET.LIB/WLMLOGINUP.FILE/%FILE%.MBR")).retrieveR
> ecordFormat
> ();
> //Create a keyed file access instance for WLMLOGIN
> KeyedFile fileWLMLOGIN = new KeyedFile(as400,
> "/QSYS.LIB/GBTINET.LIB/WLMLOGINUP.FILE/%FILE%.MBR");
> //Set the record format of file WLMLOGIN
> fileWLMLOGIN.setRecordFormat(fmtWFMLOGIN[0]);
>
> //Develop the key list.
> //Create an Object array that will represent
> the key list for WLMLOGIN.
> Object[] keyWLMLOGIN = new Object[1];
> //Set the value of the keys
> keyWLMLOGIN[0] = UserName;
>
> //Open WLMLOGIN with a file access of Read and
> Write, One record to retrieve, No commitment control to be
> used for the file.
> fileWLMLOGIN.open(AS400File.READ_WRITE, 1,
> AS400File.COMMIT_LOCK_LEVEL_NONE);
>
> //Read the first record matching the key
> Record rcdWLMLOGIN = fileWLMLOGIN.read(keyWLMLOGIN);
>
> //If Record is not null then a match on the
> key was found.
> if (rcdWLMLOGIN != null)
> {
> BigDecimal bdLstAccDate = new
> BigDecimal(DateUtil.getCurrentDate(DateUtil.CCYYMMDD_FORMAT).t
> oString());
> BigDecimal bdLstAccTime = new
> BigDecimal(DateUtil.getCurrentTime(DateUtil.MILITARY_FORMAT).t
> oString());
>
> //Always update Last accessed date and time
> rcdWLMLOGIN.setField("LSTACCDAT",(Object)
> bdLstAccDate);
> rcdWLMLOGIN.setField("LSTACCTIM",
> (Object) bdLstAccTime);
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------
>
> Here is the exception:
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------
>
> [5/12/03 14:19:59:986 NDT] a618fb9 WebGroup E
> SRVE0026E: [Servlet
> Error]-[com.membersonly.servlet.LoginServlet]:
> java.lang.ClassCastException: com.ibm.math.BigDecimal
> at
> com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(Http
> Connection.java:57)
> at
> com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnec
> tion.java:461)
> at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:414)
> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
> at
> com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchBy
> URI(ServletRequestProcessor.java:190)
> at
> com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.serv
> ice(OSEListener.java:406)
> at
> com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(Http
> Connection.java:57)
> at
> com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnec
> tion.java:461)
> at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:414)
> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
> at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:414)
> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
> at
> com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dis
> patch(ValidServletReferenceState.java:43)
> at
> com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispa
> tch(ServletInstanceReference.java:41)
> at
> com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleW
> ebAppDispatch(WebAppRequestDispatcher.java:941)
> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:614)
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------------------------
> --------------------------------------------
>
>
> Any help would be great. Thanks
>
>
> Mark Evans
> Programmer, Corporate Systems
> Johnson Inc
> Email....: mevans@xxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.