|
All, I am having a problem connecting to the AS/400 using the AS400 object to run a COBOL program. When the classes are run off the 400, everything works fine. I set the IP address of the 400, I set a username and password, and all works well. When the classes are on the 400, the host name is not set AS400 connection uses the defaults (localhost, job user, job password) for the connection. There are getter/setter methods to set the password, user name, and host name in the class with the connection to the AS400. The as400 object is defined as AS400 as400 = new AS400(); Anyone have any ideas why it does not work on the AS/400 itself, but it will work on a remote machine? I'm getting an IOException on the connect. Here is a code snippet: private void callAs400Connection() { /* * only do these checks if there is an ip address. If there is no IP * address assigned, localhost and job user are used. */ if (!getIpAddress().trim().equalsIgnoreCase("null")) { if (getUserName() == null) { throw new RuntimeException("The user name was not set."); } if (getPassword() == null) { throw new RuntimeException("The password was not set."); } /* * make sure the userID is set... */ if ((as400.getUserId()).trim().equalsIgnoreCase("")) { try { System.out.println("Setting the UserName to: " + getUserName()); as400.setUserId(getUserName()); System.out.println("Setting the Password"); as400.setPassword(getPassword()); } catch (PropertyVetoException e) { System.out.println("Problem setting the User Name. PropertyVetoException"); e.printStackTrace(System.out); } catch (ExtendedIllegalStateException e) { System.out.println("Problem setting the User Name. ExtendedIllegalStateException"); e.printStackTrace(System.out); } } /* * make sure the system name is set... */ if ((as400.getSystemName()).trim().equalsIgnoreCase("")) { try { System.out.println("Setting the System Name to: " + getIpAddress()); as400.setSystemName(getIpAddress()); } catch (PropertyVetoException e) { System.out.println("Problem setting the System Name. PropertyVetoException"); e.printStackTrace(System.out); } catch (ExtendedIllegalStateException e) { System.out.println("Problem setting the System Name. ExtendedIllegalStateException"); e.printStackTrace(System.out); } } else { System.out.println("System name already set to " + as400.getSystemName()); } } ================================ Mike Silvers AS/400 Senior Programmer/Analyst AS/400 IBM Certified RPG IV Developer AS/400 IBM Certified Solutions Expert Hainey Business Systems 8 E. Canal St Dover, PA 17315 Branch Office: (410) 397-8739 Phone: (800) 932-3380 ext. 237 Fax: (717) 292-9474 Web: http://www.hbs-inc.com ________________________________ Providing E-Commerce, EDI, AS/400 Development, Java Development, and related services nationwide. ================================
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.