Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DBConfig {
- private static final String DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
- private static final String CONN_STRING = "jdbc:mysql://localhost:3306/demo";
- private static final String USER = "root";
- private static final String PASSWORD = "1234";
- private static Connection conn;
- static Connection getConnection() throws ClassNotFoundException, SQLException {
- Class.forName(DRIVER_CLASS_NAME);
- conn = DriverManager.getConnection(CONN_STRING, USER, PASSWORD);
- return conn;
- }
- }
Add Comment
Please, Sign In to add comment