Property file can't be read
I am facing an exception when i am trying to create a connection to database.I have all the database connection strings in the database.property file .Is there anything to change in my code
java.io.FileNotFoundException: database.properties (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.jpmc.efs.tcrr.pillar.release2.JavaPoller.getCo nnection(JavaPoller.java:41)
at com.jpmc.efs.tcrr.pillar.release2.JavaPoller.main( JavaPoller.java:97).
Code:
public static Connection getConnection()
throws SQLException, IOException
{
Properties props = new Properties();
FileInputStream in = new FileInputStream("database.properties");
props.load(in);
in.close();
Connection conn = null;
try
{
OracleDataSource ods = new OracleDataSource();
ods.setDriverType(props.getProperty("driver.type") );
ods.setServerName(props.getProperty("server.name") );
ods.setNetworkProtocol(props.getProperty("network. protocol"));
ods.setDatabaseName(props.getProperty("database.na me"));
ods.setPortNumber(Integer.parseInt(props.getProper ty("port.number")));
ods.setUser(props.getProperty("user.name"));
ods.setPassword(props.getProperty("password"));
conn = ods.getConnection();
}
catch(SQLException e)
{
e.printStackTrace();
}
return conn;
}