Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4.  
  5. public class MainMySql{
  6.  
  7. private static final String driver = com.mysql.jdbc.Driver.class.getName();
  8. static String connectURL = "jdbc:mysql://localhost:3306/equities";
  9.  
  10. public static void main(String[] args) {
  11. System.out.println(driver);
  12.  
  13. try (Connection connection =
  14. DriverManager.getConnection(connectURL, "root", "password")){
  15. System.out.println("Connected");
  16. }
  17. catch (SQLException ex){
  18. System.err.println(ex);
  19. }
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement