db utility in java code example
Example: db utility in java
public class DB_Utility {
private static Connection conn;
private static Statement stmnt;
private static ResultSet rs ;
public static void createConnection() {
String connectionStr = ConfigurationReader.getProperty("database.url");
String username = ConfigurationReader.getProperty("database.username");
String password = ConfigurationReader.getProperty("database.password");
try {
conn = DriverManager.getConnection(connectionStr, username, password);
System.out.println("CONNECTION SUCCESSFUL");
} catch (SQLException e) {
System.out.println("CONNECTION HAS FAILED!");
e.printStackTrace();
}
}