update
This commit is contained in:
BIN
DEV.3.1/TP1/Vote.class
Normal file
BIN
DEV.3.1/TP1/Vote.class
Normal file
Binary file not shown.
@@ -2,24 +2,33 @@ import java.sql.*;
|
|||||||
|
|
||||||
public class Vote {
|
public class Vote {
|
||||||
|
|
||||||
private String pays;
|
private String[] pays;
|
||||||
|
|
||||||
public Vote(String pays) {
|
public Vote(String[] args) {
|
||||||
this.pays = pays;
|
this.pays = pays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vote() {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006");
|
Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006");
|
||||||
|
|
||||||
PreparedStatement pst = cnx.prepareStatement("CREATE TABLE Pays (nom_pays varchar(256));");
|
PreparedStatement pst = cnx.prepareStatement("SELECT * FROM tp1_pays AND tp1_vote;");
|
||||||
pst.executeUpdate();
|
|
||||||
PreparedStatement pst = cnx.prepareStatement("INSERT INTO Pays VALUES('Pays-Bas','Italie','Russie'");
|
|
||||||
pst.executeUpdate();
|
|
||||||
|
|
||||||
|
|
||||||
ResultSet rs = pst.executeQuery();
|
ResultSet rs = pst.executeQuery();
|
||||||
|
|
||||||
|
pst.close();
|
||||||
|
rs.close();
|
||||||
|
cnx.close();
|
||||||
} catch(SQLException e) {
|
} catch(SQLException e) {
|
||||||
System.err.println("Erreur de connexion : "+e);
|
System.err.println("Erreur de connexion : "+e);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Vote vote = new Vote();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@@ -1 +0,0 @@
|
|||||||
info/mariadb-client.jar
|
|
Reference in New Issue
Block a user