- The init method uses the Properties class to read the file
- Properties class has a load method to read a file of key/value pairs from
a stream
Properties props = new Properties();
FileInputStream in = new FileInputStream(fileName);
props.load(in);
- The getProperty method returns the value of a given key
String driver = props.getProperty("jdbc.driver");
- Now when you need a connection call
Connection conn = SimpleDataSource.getConnection();
- You need to close the connection by calling
conn.close();