Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | 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'

link comment (2)
asked 2 years ago
castle79
60
This seems to be a bug. We will investigate and get back to you with the solution. - [Level:8]CUBRID 2 years ago
Modified the answer. - [Level:8]CUBRID last year
79 Answers
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.

link comment (0)
answered 2 years ago
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: