Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. import java.sql.DriverManager;
  2. import java.sql.Connection;
  3. import java.sql.SQLException;
  4.  
  5. /**
  6.  * Created by c15osn on 2016-12-05.
  7.  */
  8. public class test{
  9.     public static void main(String[] args) {
  10.         String url = "jdbc:mysql://127.0.0.1:3306/v135h16g14";
  11.         String username = "v135h16g14";
  12.         String password = "Neungee6";
  13.  
  14.         System.out.println("Connecting database...");
  15.  
  16.         try (Connection connection = DriverManager.getConnection(url, username, password)) {
  17.             System.out.println("Database connected!");
  18.         } catch (SQLException e) {
  19.             throw new IllegalStateException("Cannot connect the database!", e);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement