Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Running batch samples in Oracle 10g

  1. #11
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    It works for me. What version of Spring Batch are you using?

  2. #12
    Join Date
    Dec 2007
    Posts
    9

    Default Re

    I am using the samples provided with spring-batch-1.0.0.m3-with-dependencies

  3. #13
    Join Date
    Dec 2007
    Posts
    25

    Default

    Even I got similar Assertion Failuer message in RestartFunctionTest. I used spring-batch-1.0.0.m3-with-dependencies release version and back end is Oracle.The sample code is inserting 2 records in the database the throws execption(as desired) and the sample code restarts all over gain and the insert 5 records including previous 2 that makes it 7(whereas expected value is 5 i.e. starting from 3rd record till 5th record).
    Any suggestion why it is behave in this manner.
    I would be glad if I can get location in the sample code where the batch framework campare the no. of records inserted(commited) and restart from next record.

  4. #14
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    It seems there is a problem with the way the restart data is being persisted. Can someone confirm that (like me) it actually works with 10g in some cases (I just downloaded the XE edition and it worked out of the box)? Can someone with a test failure also get us some more information about the restart data in between runs (it is stored in the batch_step table in plain text form)? Could there be some unusual set up where varchar columns have limited sizes smaller than required? I'm struggling to think of why it would work for me and not someone else.

  5. #15
    Join Date
    Dec 2007
    Posts
    25

    Default

    Hello,
    In reference with the above problem, I would like to provide the following input :

    Oracle JARs used : classes12.jar and ojdbc14.jar

    According to me, the problem is due to the cursor not maintaining the value of the last fetch record rather I would say JARs used might be incompatible to work with cursor properly(assumption) or there has to be some configuration done in my Oracle10g database.

  6. #16
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    Right, so you'd better check the version of Oracle that the jars come from. If it isn't 10g (and reasonably high patch level) you probably need to upgrade.

  7. #17
    Join Date
    Dec 2007
    Posts
    25

    Default

    I have used the Oracle jar compatiple with 10g and its version is 10.2.

  8. #18

    Default

    Quote Originally Posted by Dave Syer View Post
    I'm sure someone else must be using Oracle, but most of the folks I know using Spring Batch in anger seem to be on DB2 for some reason.
    I have written a restartable custom batch process using spring batch (m3), and am testing it using both Derby and Oracle (9i) as databases to hold the spring batch job control tables. I get no problems with Derby, but have the following issues with Oracle which may be relevant here:

    1. I used a SimpleJobIdentifier. When accessing the BATCH_JOB table spring batch sets the value of JOB_KEY to an empty string. (Set log4j.category.org.springframework.jdbc=DEBUG to see this). On Oracle a zero length string is treated as a NULL so on restart of a FAILED job the effective predicate in SQL to locate data on BATCH_JOB becomes <... JOB_KEY = NULL ... > where JOB_KEY data is NULL. As NULLs do not equal on SQL no row is returned and the job proceeds as if it were a new run and not a recovery of a failed run. I worked round this by using ScheduledJobIdentifier and specifying a key, but probably spring batch should either place a dummy value in JOB_KEY when one is not specified (easy) or not use JOB_KEY as a predicate in SQL commands where JOB_KEY was not specified (logical, but more complex).

    2. I also found a difference in the use of DATE for column SCHEDULE_DATE. If you set up the "Job" with a date/time value in the jobId e.g.
    jobId.setScheduleDate(new Date()); then Derby ignores the time portion, but Oracle DATE columns store it and so on recovery having a different time causes the job to fail to locate the row on BATCH_JOB. If spring batch only expects to use the date portion of the the ScheduleDate, then it might be worthwhile for it to internally set the time part to zero to avoid this discrepency. Although I accept it is easy for the caller to ensure this criterion is met.

    I'm not sure if any of this helps in this thread, but perhaps it may have some bearing on it.

  9. #19
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    All this is really useful information (so I created an issue: http://jira.springframework.org/browse/BATCH-281), and some new tests obviously need to be added. But does it explain why some people have reported failed unit tests? The tests all pass in my environment against Derby and 10g, so can anyone shed any light on that?

  10. #20
    Join Date
    Jan 2008
    Posts
    6

    Question How come I still have the issue when I used m4

    I am using 10.2.0.3 oracle driver but I am accessing an 9i database. And I still get junit.framework.AssertionFailedError: expected:<5> but was:<7>:
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •