源码
public interface Connection {    /**
     * Creates a <code>Statement</code> object for sending
     * SQL statements to the database.
     * SQL statements without parameters are normally
     * executed using <code>Statement</code> objects. If the same SQL statement 
     * is executed many times, it may be more efficient to use a 
     * <code>PreparedStatement</code> object.
     * <P>
     * Result sets created using the returned <code>Statement</code>
     * object will by default be type <code>TYPE_FORWARD_ONLY</code>
     * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
     *
     * @return a new default <code>Statement</code> object 
     * @exception SQLException if a database access error occurs
     */
   void setAutoCommit(boolean autoCommit) throws SQLException;
说下原因

解决方案 »

  1.   

    這是一個接口,不是抽像類,百度一下java抽象類吧,概念性的問題
      

  2.   

    LZ有没有注意到用到数据库的时候,倒要导入数据库提供商提供的包,然后自己通过Class.forName("xxxx")来加载相关驱动
    此时DriverManager.getConnection返回的就是具体的子类的对象举个例子
    interface A { //标准
        String getSomething();
    }class SomeA implements A { //数据库提供商
        public String getSomething() {retuen "some A";}
    }class SomeDriver { //标准
        public static getA (String className) throws Exception {
            Class c = Class.forName(className);
             return c.newInstance();
        }
    }public class Test { //用户使用
        public static void main(String[] args) throws Throwable {
            A a = SomeDriver.getA("SomeA");
            System.out.println(a.getSomething());
        }
    }
    如果LZ能理解这个例子,就能明白,为什么标准只有接口,却能调用具体的方法
    就是导入了数据库商提供的驱动包并加载,此时获得Connetion已经是一个被数据库提供商实现的类的具体对象了
      

  3.   

    // This is interface! Not abstract class!
    // please pay attention to key word