Can the method return an Object []

Object[] line = new Object[sm.getColumnCount()]; for (int i = 1; i < sm.getColumnCount(); i++) line[i--] = rs.getObject(i); rs.close(); connect.close(); return line[]; 

    1 answer 1

    Judging by the given piece, we are talking about JDBC ...

    1. Because of the line[i--] construction, you will have an infinite loop. Probably should have written line[i-1]=rs.getObject(i)
    2. If a BLOB field is encountered, Recordset.getObject() will produce a Blob pointer that refers to an InputStream that is meaningless to hold in an Object

    Summary: code is non-working, revision is required

    • yes I figured it out i-- I only need to return the line - e_klimin