Guest User

Untitled

a guest
May 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package Control;
  6.  
  7. import java.sql.Connection;
  8. import java.sql.DriverManager;
  9. import java.sql.SQLException;
  10.  
  11. /**
  12.  *
  13.  * @author theInterloper
  14.  */
  15. public class DBConnector {
  16.    
  17.     public Connection setUpConnection() throws SQLException {
  18.      String driver= ("com.mysql.jdbc.Driver");
  19.      String url = "jdbc:mysql://mysql972.cp.blacknight.com/db1075072_craftShop";
  20.      Connection connection = DriverManager.getConnection(url,"u1075072_maker", "9791513782");
  21.      try {
  22.             // Load database driver if not already loaded.
  23.             Class.forName(driver);
  24.            } catch(ClassNotFoundException cnfe) {
  25.                 System.err.println("Error loading driver: " + cnfe);
  26.            }
  27.      return connection;
  28.     }
  29.    
  30. }
Add Comment
Please, Sign In to add comment