Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class ConnexionMySQL {
- Connection mysql=null;
- boolean connecte=false;
- public ConnexionMySQL(String nomServeur, String nomBase, String nomLogin, String motDePasse) throws ClassNotFoundException, ErrorMdp{
- try {
- Class.forName("com.mysql.jdbc.Driver");
- mysql=DriverManager.getConnection("jdbc:mysql://"+nomServeur+":3306/"+nomBase,nomLogin,motDePasse);
- }
- catch (SQLException e){
- System.out.println("Msg :"+e.getMessage()+e.getErrorCode());
- if (e.getErrorCode()==1045){
- throw new ErrorMdp();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement