-
Couldn't load subscription status.
- Fork 1
Properties File
Zhamri Che Ani edited this page Dec 17, 2017
·
3 revisions
// 1. Get a connection to database
myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/DB_Name", "zhamri", "stiw2024");user=zhamri
password=stiw2024
dburl=jdbc:mysql://localhost:3306/DB_Name
// 1. Load the properties file
Properties props = new Properties();
props.load(new FileInputStream("student.properties"));
// props.load(new FileInputStream("/Users/zhamricheani/Desktop/student.properties"));
// 2. Read the props
String the_User = props.getProperty("user");
String the_Password = props.getProperty("password");
String the_Dburl = props.getProperty("dburl");
// 3. Get a connection to database
myConn = DriverManager.getConnection(the_Dburl, the_User, the_Password);