0

Goodnight.

I am currently working with a microservice that must query a function that returns an Oracle Type, I use JDBC and through a type java.sql.array I was able to obtain the response of the function, however, I do not know how to take this type to a List or ArrayList, since it requires applying business logic to the data present there

My code:

package org.tmve.subscriber;

import io.agroal.api.AgroalDataSource;
import oracle.jdbc.internal.OracleTypes;

import javax.enterprise.context.ApplicationScoped;
import java.sql.*;

@ApplicationScoped
public class Dao {

    public void getResources(AgroalDataSource dataSource, String iccid) throws SQLException {
        CallableStatement stmt = null;
        Connection conn = dataSource.getConnection();

        try {

            stmt = conn.prepareCall("{? = call CIES.CES_PACK_COMP_OPERACIONES.OBTENERINFOCTASERIAL(?)}");
            stmt.registerOutParameter(1, OracleTypes.ARRAY, ".CT_CUENTA_SERIAL");
            stmt.setString(2,iccid);
            stmt.execute();
            java.sql.Array a = stmt.getArray(1);
            System.out.println("Impresion del objeto "+a.getArray().toString());

        } catch (SQLException e) {
            throw new SQLException(e);
        } finally {
            conn.close();
        }
    }

his is how it prints the output of the java.sql.array:

enter image description here

How could I take a java.sql.array to an ArrayList data type?

Cesar Justo
  • 707
  • 2
  • 11
  • 35

0 Answers0