jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=www55rccomSQLserver
>>>>
jdbc:microsoft:sqlserver://127.0.0.1:www55rccomSQLserver

解决方案 »

  1.   

    你的Connection Statement ResultSet统统都没有关掉,查多几次数据库就爆了
      

  2.   

    源码都在这里,大家看看呢,我怎么会自己编病毒哦
    楼上是说把
    jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=www55rccomSQLserver
    换成这行?
    jdbc:microsoft:sqlserver://127.0.0.1:www55rccomSQLserver
      

  3.   

    添加finally{
    try {
    if (set != null)
    set.close();
    } catch (SQLException se) {
    }
    try {
    if (stmt != null)
    stmt.close();
    } catch (SQLException e) {
    }
    try {
    if (conn != null)
    conn.close();
    } catch (SQLException see) {
    }
    }
      

  4.   

    0210(DBoy):
    你的Connection Statement ResultSet统统都没有关掉,查多几次数据库就爆了请问怎么关,代码怎么添加,我用JSP还是新手
      

  5.   

    chenxb1980(倾听) 
    添加finally{这个添加在哪里?
    我是新手,见谅!
      

  6.   

    在executeQuery()后面加了,每次检索后都关掉,不过还是用pool的好,这样不用关/开,太费时间
      

  7.   

    不过还是用pool的好,这样不用关/开,太费时
    POOL怎么用?
      

  8.   

    有关数据库类的对象用完都必须close
      

  9.   

    public ResultSet executeQuery(String s)
        {
            rs = null;
            try
            {
                conn = DriverManager.getConnection(url, user, password);
                Statement statement = conn.createStatement(1005, 1008);
                rs = statement.executeQuery(s);
                return rs;
        
            }
            catch(SQLException sqlexception)
            {
                System.out.print(sqlexception.getMessage());
            }
            finally{
                     rs.close();
                     statement.close();
                     conn.close();
                    }
            finally应该是这样加的!如果你用JSP不如学学数据源,找找资料自己先.
      

  10.   

    顺便问一句,如果statement.close();这句抛出异常,conn.close();能关掉吗?
      

  11.   

    rs.close();
                     statement.close();
                     conn.close();
    关这里
      

  12.   

    up
    好像研究研究pool比较适合你
      

  13.   

    你的代码中间有很多明显的问题,首先,你应该把创建jdbc的错误throw 到外面去处理,因为一旦发生了Exception,这个class的实例就没有必要生成,因为jdbc创建不出来,后面就不用在executeQuery了,如果你继续执行executeQuery,反而还多处来许多错误。
    public class conn {
        public conn throws ClassNotFoundException {
            ...
            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
        }
    }
    另外一个问题出在这里
    Statement statement = conn.createStatement(1005, 1008);
    首先,我不明白你为什么要加参数,就算要加,也不应该用数字,这种方式谁看得懂啊?
    文档里面说:
    createStatement(int resultSetType, int resultSetConcurrency)你的参数含义是
    createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    不知道你为什么要用这个参数,因为你设置ResultSet为updatabale,所以才会生成大量临时文件,而且这种方法会大量占用内存,应该尽量避免使用。
      

  14.   

    另外,你的服务器应用必须要经常,显示地关闭数据库连接,否则,你的数据库服务器会受不了的。
    public class conn
    {    String user = null;
        String password = null;
        String url = null;
        Connection conn = null;
        ResultSet rs = null;    Statement stmt = null;    public conn()
        {
            ...
        }    public ResultSet executeQuery(String sql)
        {
            ...
        }    public void close()
        {
            if (rs!= null)
            try{
                rs.close();
            }catch(Exception e){
                //ignore
            }
            if (stmt != null)
            try{
                stmt.close();
            }catch(Exception e){
                //ignore
            }
            if (con != null)
            try{
                con.close();
            }catch(Exception e){
                //ignore
            }
        }
    }然后你的jsp或者bean里面要经常 conn.close();