Invalid call: it can not return ResultSet. 오류 분의

by knight posted Mar 12, 2013

1. java source

import java.sql.ResultSet;

import java.util.ArrayList;

import java.util.*;

import java.sql.*;

import dfas.dbpool.DBConnectionManager;

import dfas.custom.*;

import java.io.*;

import java.net.*;

import java.io.File;

import java.util.Date;

import java.text.*; 

import cubrid.jdbc.driver.* ;

import cubrid.sql.* ;


public class Functions {

public static  String ERROR = "";

private static DBConnectionManager connMgr; 

public static ResultSet Get_Event_List_N2(String agent_id, String e_gubun){ 

//ResultSet rs = null;

String e_ret = "", sql = "", t_usb_allow_yn = "";

int i_ret = 0, t_hb = 0, t_chk = 0, t_flag = 0, t_usb_evt_yn = 0;


if ( (agent_id.equals("") || agent_id == null) && (e_gubun.equals("") || e_gubun == null) ) {

e_ret = "반환 구분값이 입력되지 않았습니다 !";

System.exit(1);

}

connMgr = DBConnectionManager.getInstance();

Connection con = connMgr.getConnection("dbpool");

try{if(con!=null){con.setAutoCommit(false);}}catch(Exception e){}


sql = "   select a.AGENT_ID, 'N' as status, a.COLLECT_DATE, '윈도우OS' as gubun, "+

" CASE "+

" WHEN a.FLAG = '0' THEN 'OS 추가' "+

"   WHEN a.FLAG = '1' THEN 'OS 변경' "+

"   WHEN a.FLAG = '9' THEN 'OS 제거' "+

" END as content, "+

" a.CHECK_DATE, seq, 'TBL_OS_INFO' as tbl_name "+

" , a.AFTER_PRODUCT_NAME as prod_name "+

" , substr(a.BEFORE_INSTALL_DATE, 1 ,10) as pre_value "+

" , substr(a.AFTER_INSTALL_DATE, 1 ,10) as current_value "+

" , a.CREATE_DATE "+

" from tbl_os_info a "+

" where a.AGENT_ID = ? "+

" and (a.FLAG in ('0', '9') or (a.FLAG = '1' and (nvl(a.BEFORE_INSTALL_DATE, ' ') <> nvl(a.AFTER_INSTALL_DATE, ' ')))) "+

" and a.CREATE_DATE >= to_char(SYSDATE - 7, 'yyyy-mm-dd')  ";

//System.out.println("n[ Get_Event_List_N2 SQL ]n" + sql + "n[ Get_Event_List_N2 SQL ]n");


ClientInfo clientinfo = null;

ArrayList aList  = new ArrayList(); 

CUBRIDResultSet rs = null;

try{

PreparedStatement pstmt = con.prepareStatement(sql);

pstmt.setString(1, agent_id);

rs = (CUBRIDResultSet)pstmt.executeQuery();

((CUBRIDResultSet)rs).setReturnable();

return rs;

} catch ( SQLException ex ) {

   //System.err.println(ex.getMessage());

System.out.println("n[ Get_Event_List_N2 SQL Exception ]n" + ex.getMessage() + "n[ Get_Event_List_N2 SQL Exception ]n");

} catch(Exception ex){

ERROR = ex.getMessage();

System.out.println("n[ Get_Event_List_N2 Error ]n" + ERROR + "n[ Get_Event_List_N2 Error ]n");

} finally {

try{

if(rs!=null){

rs.close();

}

if(con!=null){

con.rollback();

con.close();

}

}catch(Exception e){}

connMgr.freeConnection("dbpool", con);

connMgr.release();

}


return null;

//return rs;

}

}


2. 함수 생성
create function Get_Event_List_N2(agent_id varchar, e_gubun varchar) return cursor as language java
name 'Functions.Get_Event_List_N2(java.lang.String, java.lang.String) return cubrid.jdbc.driver.CUBRIDResultSet';
commit;

3. 실행
Select Get_Event_List_N2('testid', 'OS') from db_root;

1번째 질의실행 오류 :-911

오류 설명:
Invalid call: it can not return ResultSet.

뭐가 문제일까요 ?