Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) throws SQLException,
  6. ClassNotFoundException {
  7. Connection con = null;
  8. try {
  9. Class.forName("com.mysql.jdbc.Driver");
  10. con = DriverManager.getConnection(
  11. "jdbc:mysql://url:3306/:jdbctest", "user",
  12. "pass");
  13. if (!con.isClosed()) {
  14. System.out.println("success..");
  15. }
  16. } catch (SQLException e) {
  17. System.out.println(e);
  18. } catch (ClassNotFoundException e) {
  19. System.out.println(e);
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement