Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class Connector {
  4.  
  5. public static Connection startConnection(){
  6.  
  7. Connection con = null;
  8. try {
  9. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  10. String connectionUrl = "jdbc:sqlserver://localhost:1433;database=uaa;" +
  11. "user=juan;" +
  12. "password=123";
  13.  
  14. con = DriverManager.getConnection(connectionUrl);
  15. System.out.println("Connected Successfully");
  16. }catch (Exception e) {
  17. System.out.println("Could not connect because: " + e);;
  18. }return con;
  19.  
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement