谁到这里来顶一下,我好结贴!

解决方案 »

  1.   

    是否是连接池的代码不是很好
      

  2.   

    连接数据库的代码顺序应该这样: Connection conn = null;
    Statement  stmt = null;
    ResultSet  rs   = null;

    try
    {
        Class.forName(sDBDriver);
        conn = DriverManager.getConnection(sConnStr);
        stmt = conn.createStatement();

        rs = stmt.executeQuery(sql);
    }
    catch ( Exception e )
    {
        e.printStackTrace();
    }
    finally
    {
        if ( rs != null ) rs.close();
        if ( stmt != null ) stmt.close();
        if ( conn != null ) conn.close();
    }