java hide mysql login credentials code example

Example 1: java hide mysql login credentials

private ResourceBundle reader = null;
 try{ 
     reader = ResourceBundle.getBundle("dbconfig.properties");
     Connection conn=DriverManager.getConnection(reader.getString("db.url"),reader.getString("db.username"),reader.getString("db.password"));
 }catch(Exception e){
}

Example 2: java hide mysql login credentials

/resources/dbconfig.propreties/

Example 3: java hide mysql login credentials

#DB Properties
 db.driver="driverclassname"
 db.url=jdbc:mysql://localhost:3306/YOURDBNAME
 db.username=USERNAME
 db.password=PASSWORD

Tags:

Sql Example