javax.servlet.ServletContext servletContext=request.getSession().getServletContext();
   org.springframework.web.context.WebApplicationContext webApplicationContext = org.springframework.web.context.support.WebApplicationContextUtils
.getRequiredWebApplicationContext(servletContext);
DataSource dataSource = (DataSource)webApplicationContext.getBean("dataSource");
Connection conn = null;
    ResultSet rs = null;
    Statement stmt = null;
    String SQLString = ""; //定义查询语句
    InputStream in = null; //定义输入流
    int len = 10 * 1024 * 1024; //定义字符数组长度
    
        try {
         SQLString = "select d402_02 from d402 where d402_01 ='" + request.getParameter("id")+"'";
         conn = dataSource.getConnection();
            stmt = conn.createStatement();
            rs = stmt.executeQuery(SQLString);
        } catch (Exception e) {
            System.out.println("相片-数据库操作 编号:"+request.getParameter("id"));
        }代码如上  
是从数据库里读取图片的
conn = dataSource.getConnection();
执行到这行的时候就停顿了,不能向下执行了
这是什么问题

解决方案 »

  1.   

    连接池满了有没有办法查看连接了多少呢
    我看我的系统中有很多conn = dataSource.getConnection(); 
    后没有没有conn.close();
    连接池不用关闭连接吗?
      

  2.   

    没有错误信息,我设断点执行到 conn = dataSource.getConnection();   就不能向下执行,应该是获取不到连接了
    applicationContext.xml 配置的dataSource
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName">
    <value>oracle.jdbc.driver.OracleDriver</value>
    </property>
    <property name="url">
    <value>jdbc:oracle:thin:@10.121.64.176:1521:orcl</value>
    </property>
    <property name="username">
    <value>czjm</value>
    </property>
    <property name="password">
    <value>czjm</value>
    </property>
    </bean>