简体   繁体   中英

java.sql.SQLException: Invalid column index .. how can we solve this error in following query?

String  query_creditCardDtls = " SELECT A.FUND_ACC_TYPE , C.BANK_CODE, D.KEY_2, A.DDA_ISSUE  FROM DD300MB A, DD001MB C, CA840PB D WHERE A.BR_CD = C.BR_CD AND C.BR_CD = D.BR_CD AND A.BR_CD=? AND D.MOD_CD='DD' AND D.LANG_CD='EN' AND D.KEY_1 = 'ENTITY_ID' AND A.PAYING_BANK_ID = C.BANK_CODE AND A.REF_NO=? ";
ps=con.prepareStatement(query_creditCardDtls);
ps.setString(1,iBranchCode);
ps.setString(2,Txn_ref_no);
rs = ps.executeQuery();
if (rs.next())  {

    strFundACType = rs.getString(1);
    strPayingBankId = rs.getString(2);
    strEntityId = rs.getString(3);
    strDDAIssuedFor = rs.getString(4);
}

its giving me following exception

java.sql.SQLException: Invalid column index 

but it seems there is no index error please help

Column 4 might be of a type different than string. Check your table definition. For instance if column 4 is an integer use getInt() instead of getString()

You can also use getString(columnname).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM