Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class DBConnection {
- protected static Connection initializeDB() throws SQLException, ClassNotFoundException {
- String dbDriver = "com.mysql.cj.jdbc.Driver";
- String dbUrl = "jdbc:mysql://localhost:3306/demo1";
- String username = " ";
- String password = " ";
- Class.forName(dbDriver);
- Connection con = DriverManager.getConnection(dbUrl,username,password);
- return con;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement