?? connectionfactory.java
字號:
package model;
import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.NamingException;
public class ConnectionFactory {
private BuildConnection delegate;
public ConnectionFactory(String aDriver, String aUrl, String aUserid, String aPassword) throws ClassNotFoundException {
super();
delegate = new DriverManagerConnection(aDriver, aUrl, aUserid, aPassword);
}
public ConnectionFactory(String userId, String password, String dataSource, String providerUrl, String initialContextFactory) throws NamingException {
super();
delegate = new DataSourceConnection(userId, password, dataSource, providerUrl, initialContextFactory);
}
public Connection getConnection() throws SQLException {
Connection connection = delegate.getConnection();
connection.setAutoCommit(false);
return connection;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -