Untitled

 avatar
unknown
plain_text
a year ago
1.1 kB
4
Indexable
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package gestion_stagiaire;

import com.mysql.jdbc.Connection;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.sql.*;
/**
 *
 * @author lenovo
 */
public class Connector {
    
        Connection con;
        
        Connector (){
         try {
            
            Class.forName("com.mysql.jdbc.Driver");
             System.out.println("Driver ok");
         }catch (Exception Ex){System.out.println("Driver not ok");}
         
         try {
         con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Gestion_Stagiaire","root","");
             System.out.println("Database ok");}
        catch(Exception ex) {System.out.println("Database Not ok");
        Logger.getLogger(Connector.class.getName()).log(Level.SEVERE, null, ex);
        }
        }


public Connection obtenirCon(){ return con;}
}
Editor is loading...
Leave a Comment