Hi....
I am trying to execute legacy routines from Cache 2018, into new environment with Iris 2021. I use new JDBC driver to make this connection, and change my java code to execute this legacy routines. But I get this write error: <REMOTE EXECUTE INVALID WRITE>
I changed the mnemonic routine to populate object and return this object to java. And the java class convert this object to json.
This is my simple classes used for this process, just to exemplification:
Java Class
package test;
import java.sql.SQLException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.intersystems.jdbc.IRIS;
import com.intersystems.jdbc.IRISConnection;
import com.intersystems.jdbc.IRISDataSource;
import com.intersystems.jdbc.IRISObject;
public class Reader {
public static final String CACHE_CLASS_NAME = "Utils.CSW1JavaFunctions";
public IRISConnection connection;
public IRIS iris;
public Reader(IRISConnection connection) throws SQLException {
this.connection = connection;
this.iris = IRIS.createIRIS(connection);
}
public static void main(String[] args) throws SQLException {
IRISDataSource dataSource = new IRISDataSource();
dataSource.setServerName("localhost");
dataSource.setPortNumber(1972);
dataSource.setDatabaseName("TEST");
dataSource.setUser("_SYSTEM");
dataSource.setPassword("xxxxxxxxx");
IRISConnection connection = (IRISConnection) dataSource.getConnection();
Reader reader = new Reader(connection);
try {
JsonNode jsonNode = reader.connect("IrisWrite", "param1", "param1");
System.out.println(jsonNode.toString());
} catch (Exception exc) {
exc.printStackTrace();
}
}
public JsonNode connect(String method, Object... _args) throws Exception {
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = null;
try {
IRISObject data = (IRISObject) iris.classMethodObject(CACHE_CLASS_NAME, method, _args);
String string = (String) data.invoke("%ToJSON");
data.close();
jsonNode = (JsonNode) mapper.readTree(string);
return jsonNode;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}