|
Thanks. I thought I was missing some pakcages or some logic to establish the connection and access the db. I will reach my system admin. Thanks again :-) "Clapham, Paul" <pclapham@xxxxxxxxxxxxx> wrote: "Function rejected by user exit program NW0001E in PSCOMMON" Somebody in your company wrote and installed a user exit program that controls access to your AS/400 via the entry point that the JDBC driver uses. You should ask your co-workers and find out what you have to do. PC2 -----Original Message----- From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Sivakumar Kanagavel Sent: March 15, 2007 08:51 To: java400-l@xxxxxxxxxxxx Subject: JDBC Error 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.(Ljava/lang/String;)V+4 (Throwable.java:85) java/lang/Exception.(Ljava/lang/String;)V+1 (Exception.java:33) java/sql/SQLException.(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)
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.