数据类中
public class InterfaceFactory {
OutBoundDbConnection outboundDbConnection = null;
public OutBoundDbConnection getOutboundDbConnection()
throws
InstantiationException,
IllegalAccessException,
ClassNotFoundException {
outboundDbConnection =
(OutBoundDbConnection) Class
.forName("com.isoftstone.struts.biz.dao.ConnData")
.newInstance();
return outboundDbConnection;
}
}
接口
public interface OutBoundDbConnection {
public Connection Dbconnection(String dbdrivers, String dbname);
public Connection Dbconnection();
public Connection Dbconnection1();
}
调用
InterfaceFactory interfaceFactory = new InterfaceFactory();
con = interfaceFactory.getOutboundDbConnection().Dbconnection();
连接数据池
80酷酷网 80kuku.com