bdd
This commit is contained in:
parent
a58cd8294c
commit
89b3f1aa97
2 changed files with 12 additions and 10 deletions
|
@ -53,7 +53,7 @@ public class Historique {
|
||||||
try {
|
try {
|
||||||
nb_changed_rows = this.bdd.getStatement().executeUpdate("INSERT INTO chat values ("+ctr1.getIPcode()+","+ctr2.getIPcode()+","+input+","+date+")");
|
nb_changed_rows = this.bdd.getStatement().executeUpdate("INSERT INTO chat values ("+ctr1.getIPcode()+","+ctr2.getIPcode()+","+input+","+date+")");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.out.println("insertion pas établit");
|
System.out.println("insertion pas établie");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//nb_changed_rows = this.bdd.getStatement().executeUpdate("DELETE FROM table where name=‘noname’");
|
//nb_changed_rows = this.bdd.getStatement().executeUpdate("DELETE FROM table where name=‘noname’");
|
||||||
|
@ -111,7 +111,7 @@ public class Historique {
|
||||||
//MAIN
|
//MAIN
|
||||||
public Historique() {
|
public Historique() {
|
||||||
|
|
||||||
this.bdd=new model.Database();
|
//this.bdd=new model.Database();
|
||||||
System.out.println("coucoudb");
|
System.out.println("coucoudb");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class Database {
|
||||||
this.con=DriverManager.getConnection("jdbc:mysql://srv-bdens.insa-toulouse.fr:3306","tp_servlet_003","povu3Ma2");
|
this.con=DriverManager.getConnection("jdbc:mysql://srv-bdens.insa-toulouse.fr:3306","tp_servlet_003","povu3Ma2");
|
||||||
System.out.println("coucou");
|
System.out.println("coucou");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.out.println("co pas établit");
|
System.out.println("co pas établie");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class Database {
|
||||||
this.statement=this.con.createStatement();
|
this.statement=this.con.createStatement();
|
||||||
System.out.println("coucou");
|
System.out.println("coucou");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.out.println("statement pas établit");
|
System.out.println("statement pas établi");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,21 +58,23 @@ public class Database {
|
||||||
nb_changed_rows = statement.executeUpdate("USE tp_servlet_003");
|
nb_changed_rows = statement.executeUpdate("USE tp_servlet_003");
|
||||||
System.out.println("coucou");
|
System.out.println("coucou");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.out.println("use base pas établit");
|
System.out.println("use base pas établi");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
nb_changed_rows = statement.executeUpdate("CREATE TABLE chat (user_IPcode1 INTEGER, user_IPcode2 INTEGER, Message STRING, date STRING)");
|
nb_changed_rows = statement.executeUpdate("CREATE TABLE chat ( user_IPcode1 INTEGER, user_IPcode2 INTEGER ,Message VARCHAR(450) ,temps VARCHAR(450) )");
|
||||||
System.out.println("coucou");
|
System.out.println("coucou");
|
||||||
|
System.out.println(nb_changed_rows);
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
System.out.println("table non créée");
|
System.out.println("table non créée");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if (nb_changed_rows==0){
|
// if (nb_changed_rows==0){
|
||||||
System.out.println("la modification n'a pas eu lieue");
|
// System.out.println("la modification n'a pas eu lieue");
|
||||||
};
|
// };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue