SHARE
TWEET

Untitled

a guest Oct 4th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try{
  2.     String connectionURL = "jdbc:mysql://localhost/employees";
  3.  
  4.     Connection connection = null;
  5.     Statement statement = null;
  6.     ResultSet resultSet = null;
  7.  
  8.     Class.forName("com.mysql.jdbc.Driver").newInstance();
  9.     connection = DriverManager.getConnection(connectionURL, "root", "");
  10.     statement = connection.createStatement();
  11.  
  12.     if(!connection.isClosed()){
  13.         out.println("Successfully connected to MySQL server" + "<br/>");
  14.     }
  15.  
  16. } catch(Exception ex){    
  17.  
  18.     out.println("Unable to connect to database: "+ ex);  
  19.  
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top