× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am trying to create my first stored procedure(which I have done), but
now I am trying to use it in java.  I am getting an error on the last
statement which is "An undefined column name was detected".

Can anyone see anything that I am doing wrong?  

  DriverManager.registerDriver(new
com.ibm.as400.access.AS400JDBCDriver());
Connection myConnection =
DriverManager.getConnection("jdbc:as400://S104M74M","","");
  Statement myStatement = myConnection.createStatement();
  String SQLString = new String("{CALL SBGDTATEST.TEST}");
  CallableStatement cs = myConnection.prepareCall(SQLString);   
  cs.execute();
String Column = new String("CUSTOMER_NAME");  
System.out.println( "Got from stored procedure: " + cs.getString(Column)
);

Could it be something in my stored procedure?  I wanted to try something
easy so I only selected two columns in my stored procedure and without
any parameters.  Here is how I created it:

CREATE PROCEDURE SBGDTATEST.TEST ( ) 
        LANGUAGE SQL 
        SPECIFIC SBGDTATEST.TEST 
        NOT DETERMINISTIC 
        READS SQL DATA 
        CALLED ON NULL INPUT 

        BEGIN 
        DECLARE VAR1 CHAR ; 
        DECLARE VAR2 CHAR ; 
        SELECT CUSTOMER_NUMBER, CUSTOMER_NAME INTO VAR1, VAR2 FROM
SBGDTATEST.CUSTOMER_MASTER ; 

        END  ; 

I would appreciate any suggestions.

Thanks,

Curt VanCalster
Lead Programmer
Smithfield Beef Group., - Green Bay, WI
(920) 406-1174
curt.vancalster@xxxxxxxxxx


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-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.