1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Test;
import java.beans.*;
import java.sql.*;
import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.JLabel;
import com.mysql.jdbc.Statement;
import com.mysql.jdbc.Connection;
public class GestionConnectBdD {
static String url; //10.104.100.57
static ResultSet rs;
Connection conn;
Statement stmt;
public void Connection(JLabel res, JLabel auto, String User, String Pass, String IP, String Port, String Nom) throws ClassNotFoundException, SQLException {
String pilote = "org.gjt.mm.mysql.Driver";
Class.forName(pilote);
conn = (Connection) DriverManager.getConnection(url);
stmt = (Statement) conn.createStatement();
}
public void Deconnection() throws SQLException {
rs.close();
stmt.close();
conn.close();
}
} |
Partager