Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dataBase;
- import java.sql.Connection;
- import java.sql.DriverManager;
- public class DBConnection {
- public static Connection connection;
- public static Connection getConnection()
- {
- String db_url = "jdbc:mysql://localhost/room_booking?useSSL=false";//LOGIN is the database.
- String DBName = "root";//username to connect to mysql
- String DBPassword = "root";//password to connect to mysql
- try {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- connection= DriverManager.getConnection(db_url, DBName, DBPassword);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return connection;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement