Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Connect {
- static String url = "jdbc:mysql://localhost:3306/bazy?autoReconnect=true&useSSL=false&useUnicode=yes&characterEncoding=UTF-8";
- static String username = "root";
- static String password = "root";
- protected static Connection connection = null;
- public static void connectToDatabase() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection(url, username, password);
- } catch (Exception e) {
- System.err.println("Got an exception (Connect)! ");
- System.err.println(e.getMessage());
- }
- }
- }
Add Comment
Please, Sign In to add comment