Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.univ_amu.iut;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- /**
- * Created by b16008414 on 26/09/17.
- */
- public class ConnexionUnique {
- private Connection connection;
- private static ConnexionUnique instance = null;
- private static final String CONNECT_URL = "jdbc:mysql://mysql-joebertin.alwaysdata.net:3306/joebertin_mydata";
- private static final String LOGIN = "joebertin";
- private static final String PASSWORD = "123456";
- private ConnexionUnique() {
- try {
- connection = DriverManager.getConnection(CONNECT_URL,LOGIN,PASSWORD);
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- public Connection getConnection() {
- return connection;
- }
- public static ConnexionUnique getInstance() {
- if(instance == null)
- instance = new ConnexionUnique();
- return instance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement