JDBC: Java DataBase Connector
Java操作数据库的驱动。
一、JDBC的发展
1、java --> ODBC(c语言) --> DB 桥连
2、java --> 本地clientAPI --> DB
3、java --> DB 直连[重点]
class OracleDriver{
//
void lianjie(int m){
//.....
}
//
String guan(String s1, String s2){
//...
}
}
class DB2Driver{
//
int conn(int m,int n){
//.....
}
//
void close(){
//...
}
}
class JavaApp{
public static void main(String[] args){
OracleDriver driver = new OracleDriver();
driver.lianjie(2);
driver.guan("","");
DB2Driver driver = new DB2Driver();
driver.conn(2,5);
driver.close();
}
}
interface Driver{
void getConn(String s1, String s2, String s3);
void close(int m, int n);
}
class OracleDriver implements Driver{
void getConn(String s1, String s2, String s3){
}
void close(int m, int n){
}
}
class DB2Driver implements Driver{
void getConn(String s1, String s2, String s3){
}
void close(int m, int n){
}