The first way
Properties prop= new Properties ();
Read files read through class load
InputStream is = JDBCUtils.class.getClassLoader (). getResourceAsStream ("data.properties");
Prop.load (IS);
String Driverclass = Prop.getproperty ("Driverclass");
String url = prop.getproperty ("url");
String username = prop.getproperty ("username");
String Password = prop.getproperty ("password");
The second way
Properties Properties = new properties ();
Read Property File: Use properties in Java object.
InputStream is = new FileInputStream ("Src/jdbc.properties");
Properties = new properties ();
Properties.load (IS);
String Driverclass = Properties.getproperty ("Driverclass");
String url = properties.getproperty ("url");
String username = properties.getproperty ("username");
String Password = properties.getproperty ("password");
Jdbcutils How to read the tool class configuration file