在tomcat如何配置,在jsp如何连接,用连接池方法连接SQL server2005

在tomcat怎么配置,在jsp怎么连接,用连接池方法连接SQL server2005
如题,求解答!!!!
------解决方案--------------------
引用:
Quote: 引用:

...是啊 没错啊

不要先写一个工具类封装吗?



昨晚去休息了, 你要写工具类是可以的,然后调用就好了
像这样吧:
public class DBdata
{
private Connection conn;
    private final String db_driver="net.sourceforge.jtds.jdbc.Driver";
    private final String url="jdbc:jtds:sqlserver://localhost:1433/TC";
   /*
    *  
    */
   private Connection getcon() throws SQLException
   {
    conn=null;
   try
   {
   Class.forName(db_driver);
   conn=DriverManager.getConnection(url,"sa","tcs123456");
   }catch(ClassNotFoundException ex)
   {
   System.out.println("输入有错");
   }
   return conn;
   }
 public ResultSet Unit_Sel(ArrayList hm,String sql)
   {
   try{
   conn=this.getcon();
   }catch(Exception e)
   {
   e.printStackTrace();
   }
   ResultSet rs=null;
   
 
   try{
   PreparedStatement pstmt=conn.prepareStatement(sql);
   for(int i=1;i<=hm.size();i++){
   pstmt.setString(i,(String)hm.get(i-1));
   
   }
       rs=pstmt.executeQuery();
   
   }catch(SQLException e)
   {
   e.printStackTrace();
   }
   
   return rs;
   }
//关闭
   public void close()
   {
try{
conn=this.getcon();
}catch(Exception e)
{
e.printStackTrace();
}try{
conn.close();
}catch(Exception e)
{
e.printStackTrace();
}

   }

sql 语句和变参 全部由外面调用他的方法传入