没见过!
是不是tomcat连接数据库有问题

解决方案 »

  1.   

    不太可能的,你是不是用的tomcat自带的连接池,如果不是就没有什么要设置了
    要不就是可能你的表名搞错了,本来是想取表a里面的字段,结果却写的是表b...
      

  2.   

    import java.sql.*;public class LoadDriver { 
        
        public static void main(String[] args) { 
        Connection con=null;
        ResultSet rs=null;
        Statement stmt=null;
        int i=0;
            try { 
              
                Class.forName("org.gjt.mm.mysql.Driver").newInstance(); 
                
            } catch (Exception ex) { System.out.print(ex.getMessage());
                
            }
            
            try{
             con=DriverManager.getConnection("jdbc:mysql://localhost/student_info","test","test");
             }catch(Exception ex0){System.out.print(ex0.getMessage());}
            
            try{stmt=con.createStatement();}catch(Exception ex1){System.out.print(ex1.getMessage());}        
            try{
             rs=stmt.executeQuery("select * from info");
                     }catch(Exception ex2){System.out.print(ex2.getMessage());}
          
            try{
             while(rs.next()){  
                  System.out.print(rs.getString("id"));                             
                }
             }catch(Exception ex3){
             System.out.print("ex3");        
             } 
    }
    }
      

  3.   

    比如我用rs.getString("id");
    id类型为int(3)
    int型数据用getString()??改成getInt()试试…