I am trying to pass an array of geometry to a postgis function using JDBC with JAVA:

            CallableStatement proc = conn.prepareCall("{ ? = call somefunc(?) }");
            proc.registerOutParameter(1, 7);
            PGgeometry[] arr = new PGgeometry[2];
            arr[0] = a;
            arr[1] = b;
            proc.setArray(2, conn.createArrayOf("geometry", arr));

a,b are valid PGgeometry types. I am getting this exception:

Exception in thread "main" java.lang.AbstractMethodError: org.postgresql.jdbc3g.Jdbc3gConnection.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;

Is this even possible to do? I found no good answer for that.



Found the issue, not related to geometry type. I was JDBC3 driver, replacing it to JDBC4 driver solved it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.