Class CallableServerQuery

java.lang.Object
com.aceql.jdbc.commons.CallableServerQuery

public class CallableServerQuery
extends Object
The object used for executing a remote server class that implements org.kawanfw.sql.api.server.executor.ServerQueryExecutor and returns the produced ResultSet.

Code sample:
 
 // Create the CallableServerQuery instance:
 AceQLConnection aceQLConnection = (AceQLConnection) connection;
 CallableServerQuery callableServerQuery = aceQLConnection.createCallableServerQuery();

 // The serverQueryExecutorClassName class implements the ServerQueryExecutor interface and is run
 // in the CLASSPATH of the AceQL Server:
 String serverQueryExecutorClassName = "com.mycompany.MyServerQueryExecutor";

 // Parameters to pass to MyServerQueryExecutor. We pass only one int parameter:
 List<Object> params = new ArrayList<>();
 params.add(5);

 // Call the execution of the server class and get directly a Result Set:
 try (ResultSet rs = callableServerQuery.executeServerQuery(serverQueryExecutorClassName, params);) {
     while (rs.next()) {
         out.println();
         out.println("customer_id   : " + rs.getInt("customer_id"));
         out.println("customer_title: " + rs.getString("customer_title"));
         out.println("fname         : " + rs.getString("fname"));
         out.println("lname         : " + rs.getString("lname"));
     }
 }
 
 
The code of com.mycompany.MyServerQueryExecutor server side sample is available here: MyServerQueryExecutor.java.
Since:
8.2
Author:
Nicolas de Pomereu
  • Method Details

    • executeServerQuery

      public ResultSet executeServerQuery​(String serverQueryExecutorClassName, List<Object> params) throws SQLException, IOException
      Executes a server query by calling a remote AceQL ServerQueryExecutor interface concrete implementation.
      Parameters:
      serverQueryExecutorClassName - the remote ServerQueryExecutor interface implementation name with package info
      params - the parameters to pass to the remote ServerQueryExecutor.executeQuery() implementation
      Returns:
      the ResultSet returned by serverQueryExecutorClassName
      Throws:
      SQLException - if any SQLException occurs
      IOException - if any IOException occurs