String os = "data:";
    try{
      Connection con = DriverManager.getConnection("jdbc.odbc.jdbcodbc.acc");
      Statement stmt = con.createStatement();
      String query = "Select name from user";
      ResultSet rs = stmt.executeQuery(query);
      while(rs.next()){
        String s = rs.getString("name");
        os += s;
      }
    }
    catch(Exception ee){
System.out.println("ocjbException:"+ee.toString());}在运行一下你的程序,然后看看log文里面,是否出现了异常。

解决方案 »

  1.   

    试一下这样如何?String os = "data:";
        try{
          Connection con = DriverManager.getConnection("jdbc.odbc.jdbcodbc.acc");
          Statement stmt = con.createStatement();
          String query = "Select name from user";
          ResultSet rs = stmt.executeQuery(query);
          while(rs.next()){
            String s = rs.getString("name");
            os += s;
          }
         System.out.println(os);//
       JOptionPane.showMessageDialog(null,os);//
        }
        catch(SQLException ee){}//
        
      

  2.   

    最开始没proper driver我加上Class.forName("sun.jdbc.odbc.JdbcodbcDriver");
    后还是有错
    java.security.accesscontrolexception:access denied(java.lang.runtimepermission....)
      

  3.   

    把Connection改成这个试试:Connection con = DriverManager.getConnection("jdbc.odbc.jdbcodbc.acc","","");
      

  4.   

    不对呀!!!
    在frame中也不能连接有啊!!!!