Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.SQLException;
- public class Main {
- public static void main(String[] args) {
- // create a new connection from MySQLJDBCUtil
- try (Connection conn = MySQLJDBCUtil.getConnection()) {
- // print out a message
- System.out.println(String.format("Connected to database %s "
- + "successfully.", conn.getCatalog()));
- } catch (SQLException ex) {
- System.out.println(ex.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement