package loginProject;

import java.sql.DriverManager;

public class Connects{
	public java.sql.Connection connect(){  // Class constructor creates and returns a new connection.
		java.sql.Connection con = null;
		try {
			Class.forName("com.mysql.jdbc.Driver");  // forName() loads the class of that name, creating the object of the class.
			// ** Import does not neccessarily use the classes inside.
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Test", "root", "access");
		} catch(Exception e) {
			System.out.println(e);
		}
		return con;
	}
	public static void main(String[] args) {  // Connection testing.
		Connects test = new Connects();
		System.out.println(test.connect());
	}
}