📄 dbhelper.java
字号:
package com.huanlin.utility;
import java.sql.*;
/**
* Database helper object
*
* <p>Manages database connections by using a single DataSource
* object to provide Connection objects to calling classes. This
* allows the application server to manage the connections in a
* connection pool.</p>
*
* @version 1.0
* @author Huanlin Tsai
* @since JDK 1.4
*/
public class DbHelper
{
/**
* Connecting through the Driver Manager.
*/
public static Connection getConnection()
throws ClassNotFoundException, SQLException {
String drv = AppConstants.getProperty("database.driver");
String url = AppConstants.getProperty("database.url");
String usr = AppConstants.getProperty("database.username");
String pwd = AppConstants.getProperty("database.password");
Class.forName(drv);
Connection con = DriverManager.getConnection(url, usr, pwd);
return con;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -