//connecting servlet to dbms

package dbconn;
import java.sql.*;

public class GetConnection {
    private static final String Driver="com.mysql.cj.jdbc.Driver";
    private static final String url="jdbc:mysql://localhost:3306/servlet_crud ?autoReconnect=true&useSSL=false";
    private static final String username="root";
    private static final String password="password";
    
    static public Connection getConnect() {
        Connection con=null;
        try{
            Class.forName(Driver);
            con=DriverManager.getConnection(url, username, password);
        }
        catch(Exception e){e.printStackTrace();}
        return con;
    }
}
