joseleonweb

Untitled

May 12th, 2021
548
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.sql.Connection;
  2. import java.sql.SQLException;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         // create a new connection from MySQLJDBCUtil
  8.         try (Connection conn = MySQLJDBCUtil.getConnection()) {
  9.            
  10.             // print out a message
  11.             System.out.println(String.format("Connected to database %s "
  12.                     + "successfully.", conn.getCatalog()));
  13.         } catch (SQLException ex) {
  14.             System.out.println(ex.getMessage());
  15.         }
  16.     }
  17. }
RAW Paste Data