java.sql.SQLException: Fail to convert to internal representation Exception

Viewed 32398

Please find my below query,

select nvl(max(transaction_id),0) as  transaction_id from exception_details;

If I execute the above query through my jdbc code, it is giving me java.sql.SQLException: Fail to convert to internal representation my JDBC code is as follows:

public int fetchColumnVal(String query) throws SQLException, IllegalAccessException, 
    InvocationTargetException, NoSuchMethodException, ClassNotFoundException, InstantiationException {

    PreparedStatement pstmt = null;
    Connection con = null;
    try {
        con = getConnection(true);
        pstmt = con.prepareStatement(query);
        ResultSet rs = pstmt.executeQuery();
        rs.next();
        int count=rs.getInt(1);
        return count;
    } finally {
        if (isBatchMode) {
            this.cleanResources(null, pstmt);
        }
        else {
            this.cleanResources(con, pstmt);
        }
    }
}

and the data type for the column transaction_id in the table is NUMBER

4 Answers
Related