先检查你的数据源里是不是存在你所要的数据库表,然后看看你的数据库驱动程序是否正确,你可以这样写:
public class DBConnection{
       private static String jdbcDriver="sun,jdbc.odbc.JdbcOdbcDriver";
       private static String dbName="数据库名";
       private static String urlRoot="jdbc:odbc:";
       
       public DBConnection(){
            registerDriver();
       }
    
       public void registerDriver(){
            String url=urlRoot+dbName;
           
            try{
                Class.forName(jdbcDriver);
                Connection con=DriverManager.getConnection(url);
                Statement stmt=con.createStatement();
                ResultSet rs=stmt.executeQuery(SQL语句);
                .
                . 
                .
            }
            catch(ClassNotFoundException e){
                 System.err.println(e.getMessage());
            }
            catch(SQLException e){
                 System.err.println(e.getMessage());
            }