Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3.  
  4. public class Main {
  5.  
  6.     static String driver = "com.mysql.jdbc.Driver";
  7.     static String url = "jdbc:mysql://localhost:3306/dice_game";
  8.    
  9.    
  10.     public static void main(String[] args) {
  11.         // TODO Auto-generated method stub
  12.        
  13.         try {
  14.             Class.forName(driver).newInstance();
  15.             System.out.println("Success!");
  16.         } catch (Exception e) {
  17.             System.out.println("Driver error");
  18.             e.printStackTrace();
  19.         }
  20.        
  21.         try {
  22.         Connection con = DriverManager.getConnection(url, "root", "");
  23.         } catch (Exception e) {
  24.             System.out.println("Connection error");
  25.             //e.printStackTrace();
  26.         }
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement