Open Source RDBMS - Seamless, Scalable, Stable and Free

English | Login |Register


0
(click on this box to dismiss)

Java Stored Procedure: Invalid call: it can not return ResultSet

I am running the following example in my cubrid database.

function:

create function rset() return cursor
as language java
name 'JavaSP2.TResultSet() return java.sql.ResultSet'

Stored procedure:

public static class JavaSP2 {
public static ResultSet TResultSet(){

try{
Class.forName("cubrid.jdbc.driver.CUBRIDDriver");
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
((CUBRIDConnection)con).setCharset("euc_kr");

String sql = "select * from station";
Statement stmt=con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
((CUBRIDResultSet)rs).setReturnable();

return rs;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
} 

CUBRID says:   

execute error:-911
line 1 is not executed (error)Error description:
Invalid call: it can not return ResultSet. 

I try to solve it doing casting but dont work. When I registering the function cubrid dont allow set  java.sql.ResultSet as return value instead use

CREATE FUNCTION "rset"() RETURN CURSOR
AS LANGUAGE JAVA 
NAME 'JavaSP2.TResultSet() return cubrid.jdbc.driver.CUBRIDResultSet'

링크 댓글 쓰기 (2)
질문시간 2년 전
castle79
60
This seems to be a bug. We will investigate and get back to you with the solution. - [레벨:8]CUBRID 2년 전
Modified the answer. - [레벨:8]CUBRID 11달 전
79 답변들
0

As mentioned in http://jira.cubrid.org/browse/ENGINE-32, in the Java Stored Procedure you should use different URL connection. You should use "jdbc:default:connection:" not "jdbc:CUBRID:localhost:...".

Please refer http://www.cubrid.org/manual/91/en/sql/jsp.html#using-server-side-internal-jdbc-driver.

And for resultset, please refer http://www.cubrid.org/manual/91/en/sql/jsp.html#returning-java-sql-resultset-in-java-stored-procedure.

링크 댓글 쓰기 (0)
답변시간 2년 전
dba
558




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: