|
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 { Class.forName("com.ibm.as400.access.AS400JDBCDriver"); 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)); } rs.close(); stm.close(); 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 advance. 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) java/sql/SQLException.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:34) com/ibm/as400/access/JDError.throwSQLException(Lcom/ibm/as400/access/AS 400JDBCConnection;III)V+0 (JDError.java:388) com/ibm/as400/access/AS400JDBCStatement.commonPrepare(Lcom/ibm/as400/ac cess/JDSQLStatement;)Lcom/ibm/as400/access/JDServerRow;+0 (AS400JDBCStatement .java:801) com/ibm/as400/access/AS400JDBCStatement.executeQuery(Ljava/lang/String; )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 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.