Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. package data.util;
  2.  
  3. import util.BreakoutException;
  4.  
  5. import java.sql.Connection;
  6. import java.sql.DriverManager;
  7. import java.sql.SQLException;
  8.  
  9. /**
  10. * Created by vande on 2/12/2017.
  11. */
  12. public class MySqlConnection {
  13.  
  14. //private static String URL = "jdbc:mysql://localhost:3306/AtariBreakout";
  15. private static String URL = "jdbc:mysql://sql11.freemysqlhosting.net:3306/sql11210642";
  16. private static String UID = "sql11210642";
  17. private static String PWD = "fYXYkF9yaq";
  18.  
  19. static {
  20. try {
  21. Class.forName("com.mysql.jdbc.Driver");
  22. } catch (ClassNotFoundException e) {
  23. e.printStackTrace();
  24. }
  25. }
  26.  
  27. private MySqlConnection() {
  28.  
  29. }
  30.  
  31. public static Connection getConnection() {
  32. try {
  33. return DriverManager.getConnection(URL, UID, PWD);
  34. } catch (SQLException e) {
  35. throw new BreakoutException("Couldn't connect to DB", e);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement