关闭数据库连接时报空指针

    xiaoxiao2022-06-23  19

    切记,关闭数据库时,一定要判断是否为空,如果为空,不需要关闭,否则会报空指针异常

    } finally {

                    try {                     if (stmt != null){                         stmt.close();                     }                     if (conn != null){                         conn.close();// 关闭连接                     }                 } catch (Exception innerex) {                     innerex.printStackTrace();                 }             }
    转载请注明原文地址: https://ju.6miu.com/read-1123204.html

    最新回复(0)