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
| package database
import java.sql.*;
public class Connexion {
private Connection con;
private Statement st;
private ResultSet rs;
public connexion () throws Exception {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/stage","root","pass");
st =con.createStatement();
}
public void Update (String sql) throws Exception {
st.executeUpdate(sql);
}
public ResultSet select(String sql)throws Exception {
rs = st.executeQuery(sql);
return rs;
}
public static void main(String[] args) {
}
} |
Partager