I am trying to learn Java and how to access AS/400 data using JDBC and wrote a 
small program :
  import java.sql.*;                                            
public class MyDBRead{                                        
public static void main (String argv []){                    
  try {                                                                         
  String sys = "TESTSYS1";                                       
  String user = "SIVAKUMARK";                                 
  String pass = "TEXAS1";                                    
  Connection con =  DriverManager.getConnection("jdbc:as400://"+sys,user,pass); 
  Statement stm = con.createStatement();                      
  ResultSet rs = stm.executeQuery("select FIELD1 from MYFILE");
  while(rs.next())  {                                     
    System.out.println(rs.getString(1)); }                                     
 con.close();   }                                      
 catch(Exception e) {                                       
  e.printStackTrace();  }                                        
 }      }
  The code compiled without any error. While trying to execute, its throwing 
following exceptions. Can someone tell what I am missing here?. Thanks for in 
  java.sql.SQLException: [PWS9801] Function rejected by user exit program 
NW0001E in PSCOMMON.                                                            
      java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:85)  
      java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:33)  
400JDBCConnection;III)V+0 (JDError.java:388)                                 
cess/JDSQLStatement;)Lcom/ibm/as400/access/JDServerRow;+0 (AS400JDBCStatement
)Ljava/sql/ResultSet;+0 (AS400JDBCStatement.java:1355)                       
      MyDBRead.main([Ljava/lang/String;)V+0 (MyDBRead.java:7)                   

Looking for earth-friendly autos? 
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.  

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.