Untitled

 avatar
unknown
plain_text
a year ago
683 B
5
Indexable
import java.sql.*;
import java.sql.DriverManager;

public class Connecter {
    Connection con;
    public Connecter() {

        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            System.out.println("connection ok");
        } catch (ClassNotFoundException e) {
            System.out.println("connection not ok");
            throw new RuntimeException(e);
        }
        try {
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/gestion_stagiare", "root", "");
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
    public Connection obtenirConnection(){return con;}
}
Editor is loading...
Leave a Comment