Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package utilitaire;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class ConnectionDB {
- private static Connection connection;
- static {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test" , "root" , "");
- } catch (ClassNotFoundException | SQLException e) {
- throw new RuntimeException("not connected " ,e);
- }
- }
- public static Connection getConnection() {
- return connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement