Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:46:00+00:00 2026-06-04T00:46:00+00:00

I am using the following code to consume a CUBRID database java stored procedure.

  • 0

I am using the following code to consume a CUBRID database java stored procedure.

string ConnectionString = "server=localhost;database=demodb;port=30000;user=dba;password=123456";
DataTable dt = new DataTable();
DataSet ds = new DataSet();
CUBRIDConnection con = new CUBRIDConnection(ConnectionString);
CUBRIDCommand com = new CUBRIDCommand();
com.CommandType = CommandType.StoredProcedure;
com.Connection = con;
com.CommandText = "select rset()";
CUBRIDParameter pan = new CUBRIDParameter();
pan.Direction = ParameterDirection.Output;
pan.CUBRIDDataType = CUBRIDDataType.CCI_U_TYPE_RESULTSET;
pan.ParameterName = "?p1";
CUBRIDDataAdapter dap = new CUBRIDDataAdapter(com);
con.Open();
int val =  dap.Fill(ds);
con.Close();

and in the server use the next function and stored procedure in the server

public class JavaSP3 {
public static ResultSet TResultSet(){
try {
Class.forName("cubrid.jdbc.driver.CUBRIDDriver"); 
Connection con = DriverManager.getConnection("jdbc:default:connection:"); 
String sql = "select * from athlete"; 
Statement stmt=con.createStatement(); 
ResultSet rs = stmt.executeQuery(sql); 
((CUBRIDResultSet)rs).setReturnable(); 
return rs;
}
catch (Exception e) 
{
e.printStackTrace();
}
return null;        
}
}

and the function code is this

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

I run this with a function that result a string and return the value, but when I change to CUBRIDResultSet value dont work and CUBRID says>

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

Please, I have 3 days trying to solve this any one can help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:46:02+00:00Added an answer on June 4, 2026 at 12:46 am

    ADO.NET dont provide support for ResultSet.

    http://www.cubrid.org/?mid=forum&category=195532&document_srl=358924

    using System.Data;
    using CUBRID.Data.CUBRIDClient;
    using System.Data.Common;
    using System;
    
    namespace ConsoleApplication1
    {
    class Program
    {
        static void Main(string[] args)
        {
    
            string ConnectionString = "server=localhost;database=demodb;port=30000;user=dba;password=123456";
            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            CUBRIDConnection con = new CUBRIDConnection(ConnectionString);
    
            CUBRIDCommand com = new CUBRIDCommand();
            com.CommandType = CommandType.Text; //Important ADO.NET driver crash using call convention
            com.Connection = con;
            com.CommandText = "select rset();";
            CUBRIDParameter pan = new CUBRIDParameter();
            con.Open();
            DbDataReader reader = com.ExecuteReader();
            CustomAdapter da = new CustomAdapter();
            da.FillFromReader(dt, reader);
            con.Close();
    
            DataRow fila = dt.Rows[0];
            Console.WriteLine(fila[0].ToString());
            Console.ReadKey();            
    
        }
    }
    
    
    public class CustomAdapter : System.Data.Common.DbDataAdapter
    {
        public int FillFromReader(DataTable dataTable, IDataReader dataReader)
        {
            return this.Fill(dataTable, dataReader);
        }
        protected override System.Data.Common.RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow a, IDbCommand b, StatementType c, System.Data.Common.DataTableMapping d)
        {
            return (System.Data.Common.RowUpdatedEventArgs)new EventArgs();
        }
    
        protected override System.Data.Common.RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow a, IDbCommand b, StatementType c, System.Data.Common.DataTableMapping d)
        {
            return (System.Data.Common.RowUpdatingEventArgs)new EventArgs();
        }
    
        protected override void OnRowUpdated(System.Data.Common.RowUpdatedEventArgs value)
        {
    
    
        }
        protected override void OnRowUpdating(System.Data.Common.RowUpdatingEventArgs value)
        {
    
    
        }
    } 
    

    java class

    import java.sql.*;
    
    import cubrid.jdbc.driver.*;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.dom.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    
    public class JavaSP3 {
    public static String TResultSet(){
    ResultSet rs = null;
    Statement stmt = null;
    String sql;
    try {
               Class.forName("cubrid.jdbc.driver.CUBRIDDriver"); 
               Connection con = DriverManager.getConnection("jdbc:default:connection:"); 
              ((CUBRIDConnection)con).setCharset("euc_kr"); 
    
                      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                      DocumentBuilder builder =factory.newDocumentBuilder();
                      Document doc = builder.newDocument();
                      Element results = doc.createElement("Results");
                      doc.appendChild(results);
    
                      sql = "select * from athlete"; 
                       stmt=con.createStatement(); 
                       rs = stmt.executeQuery(sql); 
                      ResultSetMetaData rsmd = rs.getMetaData();
                      int colCount = rsmd.getColumnCount();
    
                     while (rs.next()) {
                        Element row = doc.createElement("Row");
                        results.appendChild(row);
                        for (int ii = 1; ii <= colCount; ii++) {
                           String columnName = rsmd.getColumnName(ii);
                           Object value = rs.getObject(ii);
                           Element node = doc.createElement(columnName);
                           node.appendChild(doc.createTextNode(value.toString()));
                           row.appendChild(node);
                        }
                      }
    
    
                     String valor = getDocumentAsXml(doc);
                     return valor;
    
        } 
        catch (Exception e) 
        {
            e.printStackTrace();
        }
        return null;
    }
    
    public static String getDocumentAsXml(Document doc)
          throws TransformerConfigurationException, TransformerException {
        DOMSource domSource = new DOMSource(doc);
        TransformerFactory tf = TransformerFactory.newInstance();
        Transformer transformer = tf.newTransformer();
        //transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
        transformer.setOutputProperty
           ("{http://xml.apache.org/xslt}indent-amount", "4");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    
        java.io.StringWriter sw = new java.io.StringWriter();
        StreamResult sr = new StreamResult(sw);
        transformer.transform(domSource, sr);
        return sw.toString();
     }
    
    }
    

    Cubrid function

    CREATE FUNCTION "rset"() RETURN STRING
    AS LANGUAGE JAVA 
    NAME 'JavaSP3.TResultSet() return java.lang.String'
    

    This allow you get data from Java stored procedures in CUBRID using ADO.NET

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using following code to handle all the unhandled exceptions in the program.
I am using following code to remove some specific nodes from xml file..It show
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I am using following code to check whether a check box on my website
I am using following code to design my home page. The output (as shown
I'm using following code but cannot return data from MySQL. This is the output:
I am using following code to create new wifi access point and to connect
i am using following code. <RelativeLayout android:layout_width=310dp android:layout_height=70dp android:layout_below=@+id/UIReportView android:layout_marginLeft=4dp android:layout_marginTop=2dp android:background=@drawable/small_corners > small_corners

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.