最近发现下面程序中用到的Statement、Connection和ResultSet都是接口。该程序运行良好,但谁实现了这些接口?
package jdbc;
import java.sql.*;
public class Mango {
public static void main(String[] args) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@66.66.66.128:1521:xe","SYSTEM","matrix");
Statement comm = con.createStatement();
comm.executeQuery("insert into a values('a',1)");
ResultSet res = comm.executeQuery("SELECT * FROM A");
comm.executeQuery("insert into a values('a',1)");
while(res.next()) {
System.out.println(res.getString(1) + " " + res.getInt(2));
}
}
}