0

There is a Postgresql database with the following function stub

CREATE OR REPLACE FUNCTION net_train(terms text[], perceptron_id integer)
  RETURNS void AS
$BODY$begin
-- stub
end;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION net_train(text[], integer)
  OWNER TO postgres;

How by a call in java to the program to transfer an array of terms (also it would be desirable to know as to transfer the second parameter) to this function? The input array of terms is written in

ArrayList<String> ProcessedTherms = new ArrayList<String>();

1 Answer 1

1

We used ibatis for mapping, but it should be similar:

Connection conn = ps.getConnection(); //ps is prepared statement
ArrayList arr = (ArrayList) param;
final Array sqlArray = conn.createArrayOf("integer", arr.toArray()); // we had integers, should be similar for String
ps.setArray(i, sqlArray);// i is position of parameter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.