Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Connection getConnection() throws Exception{
- try {
- String driver= "com.mysql.jdbc.Driver";
- String url= "jdbc:mysql://localhost:3306/engine";//mysql database; localhost = ur computer, IP address = server; name of database
- String user= "phill"; //user name. idk if it's necessary
- String password= "mypass"; //user password. idk if it's necessary
- Class.forName(driver);
- Connection con= DriverManager.getConnection(url, user, password);
- System.out.println("connected");
- return con;
- } catch (Exception e) {System.out.println(e);}
- return null;
- }
Add Comment
Please, Sign In to add comment