I would like to know if my java db class is enough protected against hackers. (I'm currently developing an Android application). I protect it with a infos.properties file which contains every information that I need.
final class DB {
static final String DRIVER;
static final String URL;
static final String USER;
static final String PASSWORD;
static {
Properties prop = new Properties();
try {
prop.load(new FileInputStream("infos.properties"));
} catch (IOException e) {
e.printStackTrace();
}
DRIVER = prop.getProperty("DRIVER");
URL = prop.getProperty("URL");
USER = prop.getProperty("user");
PASSWORD = prop.getProperty("password");
}
public static ResultSet doQuery(String query)
{
try {
Class.forName(DRIVER);
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
if (rs != null) rs.close();
if (stmt != null) stmt.close();
if (conn != null) conn.close();
return (rs);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
If it is not enough protected, what should I do then ?