update
This commit is contained in:
30
DEV.3.1/TP/TP1/MonProgramme.java
Normal file
30
DEV.3.1/TP/TP1/MonProgramme.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.sql.*;
|
||||
|
||||
public class MonProgramme {
|
||||
|
||||
public MonProgramme() {
|
||||
try {
|
||||
Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006");
|
||||
|
||||
PreparedStatement pst = cnx.prepareStatement("SELECT valeur FROM Mesure WHERE valeur BETWEEN ? AND ?");
|
||||
pst.setInt(1, 50);
|
||||
pst.setInt(2, 100);
|
||||
ResultSet rs = pst.executeQuery();
|
||||
|
||||
}catch(SQLException e) {
|
||||
System.err.println("Connexion echouee : "+e);
|
||||
}
|
||||
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
} catch(ClassNotFoundException e) {
|
||||
System.err.println("Classe non trouvee : "+e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
MonProgramme monpgr = new MonProgramme();
|
||||
}
|
||||
|
||||
}
|
BIN
DEV.3.1/TP/TP1/Vote.class
Normal file
BIN
DEV.3.1/TP/TP1/Vote.class
Normal file
Binary file not shown.
34
DEV.3.1/TP/TP1/Vote.java
Normal file
34
DEV.3.1/TP/TP1/Vote.java
Normal file
@@ -0,0 +1,34 @@
|
||||
import java.sql.*;
|
||||
|
||||
public class Vote {
|
||||
|
||||
private String[] pays;
|
||||
|
||||
public Vote(String[] args) {
|
||||
this.pays = pays;
|
||||
}
|
||||
|
||||
public Vote() {
|
||||
|
||||
try{
|
||||
Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006");
|
||||
|
||||
PreparedStatement pst = cnx.prepareStatement("SELECT * FROM tp1_pays AND tp1_vote;");
|
||||
|
||||
|
||||
ResultSet rs = pst.executeQuery();
|
||||
|
||||
pst.close();
|
||||
rs.close();
|
||||
cnx.close();
|
||||
} catch(SQLException e) {
|
||||
System.err.println("Erreur de connexion : "+e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Vote vote = new Vote();
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user