How to resolve java.sql.SQLException: Fail to construct descriptor:TYPECODE_VARCHAR2 Unable to resolve type...












1















Been trying to call an oracle stored procedure that would take 8 parameters and the 8th is an array that we need to pass. below is the code piece and It's throwing an error. I'm not sure what to pass to createDescriptor method as argument 1 , because whatever I pass it's giving the same error. I've taken the values from Fields inherited part , from the following link (Any help would be appreciated a lot )https://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html




java.sql.SQLException: Fail to construct descriptor: Unable to resolve java.sql.SQLException: Fail to construct descriptor:TYPECODE_VARCHAR2




Code:



structDescriptor = StructDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection()); 
arrayDescriptor = ArrayDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection());
ARRAY arr = new ARRAY(arrayDescriptor, oracleConnection.getMetaData().getConnection(), accountArray);
try {
//Array array = oracleConnection.createARRAY("OBJECT", new Object { "176354516912167301", "177254516082228201" });
OracleCallableStatement cstmt = (OracleCallableStatement) oracleConnection.prepareCall("{call COPY_FUNCTIONALITY.COPY_ADDRESS(?,?,?,?,?,?,?,?)}");

cstmt.setString(1, "ABCD");
cstmt.setString(2, "PASZKAL");
cstmt.setString(3, "624954458340565301");
cstmt.setString(4, "ALL");
cstmt.setString(5, "RECURRING_ENTERED");
cstmt.setBoolean(6, false);
cstmt.setBoolean(7, false);
cstmt.setArray(8, arr);
//cstmt.setArray(8, array_to_pass);

ResultSet rs = cstmt.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}









share|improve this question

























  • Can you add declaration of method, and definition of array type (collection).

    – Arkadiusz Łukasiewicz
    Jan 2 at 10:50











  • Please provide the definition of TYPECODE_VARCHAR2. BTW the name doesn't sound right. You would typically choose a name that represents something like "CAR_COLLECTION" in case of an array of cars.

    – Jean de Lavarene
    Jan 3 at 12:12
















1















Been trying to call an oracle stored procedure that would take 8 parameters and the 8th is an array that we need to pass. below is the code piece and It's throwing an error. I'm not sure what to pass to createDescriptor method as argument 1 , because whatever I pass it's giving the same error. I've taken the values from Fields inherited part , from the following link (Any help would be appreciated a lot )https://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html




java.sql.SQLException: Fail to construct descriptor: Unable to resolve java.sql.SQLException: Fail to construct descriptor:TYPECODE_VARCHAR2




Code:



structDescriptor = StructDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection()); 
arrayDescriptor = ArrayDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection());
ARRAY arr = new ARRAY(arrayDescriptor, oracleConnection.getMetaData().getConnection(), accountArray);
try {
//Array array = oracleConnection.createARRAY("OBJECT", new Object { "176354516912167301", "177254516082228201" });
OracleCallableStatement cstmt = (OracleCallableStatement) oracleConnection.prepareCall("{call COPY_FUNCTIONALITY.COPY_ADDRESS(?,?,?,?,?,?,?,?)}");

cstmt.setString(1, "ABCD");
cstmt.setString(2, "PASZKAL");
cstmt.setString(3, "624954458340565301");
cstmt.setString(4, "ALL");
cstmt.setString(5, "RECURRING_ENTERED");
cstmt.setBoolean(6, false);
cstmt.setBoolean(7, false);
cstmt.setArray(8, arr);
//cstmt.setArray(8, array_to_pass);

ResultSet rs = cstmt.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}









share|improve this question

























  • Can you add declaration of method, and definition of array type (collection).

    – Arkadiusz Łukasiewicz
    Jan 2 at 10:50











  • Please provide the definition of TYPECODE_VARCHAR2. BTW the name doesn't sound right. You would typically choose a name that represents something like "CAR_COLLECTION" in case of an array of cars.

    – Jean de Lavarene
    Jan 3 at 12:12














1












1








1








Been trying to call an oracle stored procedure that would take 8 parameters and the 8th is an array that we need to pass. below is the code piece and It's throwing an error. I'm not sure what to pass to createDescriptor method as argument 1 , because whatever I pass it's giving the same error. I've taken the values from Fields inherited part , from the following link (Any help would be appreciated a lot )https://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html




java.sql.SQLException: Fail to construct descriptor: Unable to resolve java.sql.SQLException: Fail to construct descriptor:TYPECODE_VARCHAR2




Code:



structDescriptor = StructDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection()); 
arrayDescriptor = ArrayDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection());
ARRAY arr = new ARRAY(arrayDescriptor, oracleConnection.getMetaData().getConnection(), accountArray);
try {
//Array array = oracleConnection.createARRAY("OBJECT", new Object { "176354516912167301", "177254516082228201" });
OracleCallableStatement cstmt = (OracleCallableStatement) oracleConnection.prepareCall("{call COPY_FUNCTIONALITY.COPY_ADDRESS(?,?,?,?,?,?,?,?)}");

cstmt.setString(1, "ABCD");
cstmt.setString(2, "PASZKAL");
cstmt.setString(3, "624954458340565301");
cstmt.setString(4, "ALL");
cstmt.setString(5, "RECURRING_ENTERED");
cstmt.setBoolean(6, false);
cstmt.setBoolean(7, false);
cstmt.setArray(8, arr);
//cstmt.setArray(8, array_to_pass);

ResultSet rs = cstmt.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}









share|improve this question
















Been trying to call an oracle stored procedure that would take 8 parameters and the 8th is an array that we need to pass. below is the code piece and It's throwing an error. I'm not sure what to pass to createDescriptor method as argument 1 , because whatever I pass it's giving the same error. I've taken the values from Fields inherited part , from the following link (Any help would be appreciated a lot )https://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html




java.sql.SQLException: Fail to construct descriptor: Unable to resolve java.sql.SQLException: Fail to construct descriptor:TYPECODE_VARCHAR2




Code:



structDescriptor = StructDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection()); 
arrayDescriptor = ArrayDescriptor.createDescriptor("TYPECODE_VARCHAR2", oracleConnection.getMetaData().getConnection());
ARRAY arr = new ARRAY(arrayDescriptor, oracleConnection.getMetaData().getConnection(), accountArray);
try {
//Array array = oracleConnection.createARRAY("OBJECT", new Object { "176354516912167301", "177254516082228201" });
OracleCallableStatement cstmt = (OracleCallableStatement) oracleConnection.prepareCall("{call COPY_FUNCTIONALITY.COPY_ADDRESS(?,?,?,?,?,?,?,?)}");

cstmt.setString(1, "ABCD");
cstmt.setString(2, "PASZKAL");
cstmt.setString(3, "624954458340565301");
cstmt.setString(4, "ALL");
cstmt.setString(5, "RECURRING_ENTERED");
cstmt.setBoolean(6, false);
cstmt.setBoolean(7, false);
cstmt.setArray(8, arr);
//cstmt.setArray(8, array_to_pass);

ResultSet rs = cstmt.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}






java oracle stored-procedures jdbc callable-statement






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 0:11









Gord Thompson

78.5k1497225




78.5k1497225










asked Jan 1 at 23:52









RonaldRonald

13012




13012













  • Can you add declaration of method, and definition of array type (collection).

    – Arkadiusz Łukasiewicz
    Jan 2 at 10:50











  • Please provide the definition of TYPECODE_VARCHAR2. BTW the name doesn't sound right. You would typically choose a name that represents something like "CAR_COLLECTION" in case of an array of cars.

    – Jean de Lavarene
    Jan 3 at 12:12



















  • Can you add declaration of method, and definition of array type (collection).

    – Arkadiusz Łukasiewicz
    Jan 2 at 10:50











  • Please provide the definition of TYPECODE_VARCHAR2. BTW the name doesn't sound right. You would typically choose a name that represents something like "CAR_COLLECTION" in case of an array of cars.

    – Jean de Lavarene
    Jan 3 at 12:12

















Can you add declaration of method, and definition of array type (collection).

– Arkadiusz Łukasiewicz
Jan 2 at 10:50





Can you add declaration of method, and definition of array type (collection).

– Arkadiusz Łukasiewicz
Jan 2 at 10:50













Please provide the definition of TYPECODE_VARCHAR2. BTW the name doesn't sound right. You would typically choose a name that represents something like "CAR_COLLECTION" in case of an array of cars.

– Jean de Lavarene
Jan 3 at 12:12





Please provide the definition of TYPECODE_VARCHAR2. BTW the name doesn't sound right. You would typically choose a name that represents something like "CAR_COLLECTION" in case of an array of cars.

– Jean de Lavarene
Jan 3 at 12:12












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999851%2fhow-to-resolve-java-sql-sqlexception-fail-to-construct-descriptortypecode-varc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53999851%2fhow-to-resolve-java-sql-sqlexception-fail-to-construct-descriptortypecode-varc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

How to fix TextFormField cause rebuild widget in Flutter