Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final String url = "jdbc:mysql://127.0.0.1:3306/mybd?autoReconnect=true&useSSL=false";
- private static final String user = "root";
- private static final String password = "welcome";
- private static Connection con;
- public static void connecttodb() {
- // opening database connection to MySQL server
- con = DriverManager.getConnection(url, user, password);
- }
- private static final String url = "jdbc:mysql://127.0.0.1:3306/mybd?autoReconnect=true&useSSL=false";
- private static final String user = "root";
- private static final String password = "welcome";
- private static Connection con;
- public static void connecttodb() {
- // This will load the MySQL driver, each DB has its own driver
- Class.forName("com.mysql.jdbc.Driver");
- // Setup the connection with the DB
- con = DriverManager.getConnection(url, user, password);
- }
Add Comment
Please, Sign In to add comment