Guest User

sql

a guest
May 16th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. package me.frog.sql;
  2.  
  3. public class Core extends JavaPlugin {
  4.  
  5. public static MySQL mysql;
  6. private static Connection connection;
  7.  
  8. public void onEnable() {
  9. //format: new MySQL(port, user, password, database);
  10. mysql = new MySQL("localhost", "root", "password", "nick69");
  11. }
  12.  
  13. public MySQL(String ip, String userName, String password, String db) {
  14. try {
  15. Class.forName("com.mysql.jdbc.Driver");
  16. connection = DriverManager.getConnection("jdbc:mysql://" + ip + "/" + db + "?user=" + userName + "&password=" + password);
  17. } catch (Exception e) {
  18. e.printStackTrace();
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment