dbconfigreader.java
来自「使用JFREECHART组件 读取数据库数据」· Java 代码 · 共 45 行
JAVA
45 行
package cn.itcast.utils;
import java.io.InputStream;
import java.util.Properties;
public class DBConfigReader {
private static Properties properties = new Properties();
private static String fileName = "jdbc.properties";
static{
try {
InputStream is = null;
is= DBConfigReader.class.getClassLoader().getResourceAsStream(fileName);
properties.load(is);
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getDriverName(){
//System.out.println(properties.getProperty("driverClassName"));
return properties.getProperty("driverClassName");
}
public static String getURL(){
//System.out.println(properties.getProperty("url"));
return properties.getProperty("url");
}
public static String getUsername(){
//System.out.println(properties.getProperty("username"));
return properties.getProperty("username");
}
public static String getPassword(){
//System.out.println(properties.getProperty("password"));
return properties.getProperty("password");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?