Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem Reading Data Area in AS400

843854Apr 14 2005 — edited Apr 14 2005
First of all, I would like to apologize if i am not in the correct forum. Please kindly inform me if i did so.

I am trying to read some data from a data area in AS400 by using the jt400.jar provided by IBM.

I have successfully retrieve the data and printed it out into a file. But, my application didn't stop and still running. I have to manually stop/kill the process.

Below is the code snippet:
import java.sql.*;
import com.ibm.as400.access.*;

public class AreaData implements Runnable {

   private static LogWriter log;

   private AS400 system;
   private QSYSObjectPathName path;
   private CharacterDataArea charDataArea;

   public AreaData () {

      super();

      try {
            log = new LogWriter("AreaData.log");
      } catch (Exception e) {
            System.out.println("Log create failed.");
            System.out.println(e.getMessage());
      }
   }

   public static void main (String[] arg) {

      try {
            AreaData da = new AreaData();
           Thread thread = new Thread(da);
           thread.start();
      } catch(Exception e) {
           log.write("Thread run failed : " + e.getMessage());
      }
   }

   public void run() {
      try {
           system = new AS400("SystemName", "userid", "password");
           path = new QSYSObjectPathName("library", "object", "DTAARA");
           charDataArea = new CharacterDataArea(system, path.getPath());

           String text = charDataArea.read();
           log.write(text);
       } catch (Exception dataAreaExp) {
           log.write("Data Area : " + dataAreaExp.getMessage());
       }
   }
Any reply is appreciated and thanks in advanced.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2005
Added on Apr 14 2005
1 comment
391 views