Bonjour,

J'ai fais le programme suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
public class Requetes{
 
public static void requete(String s) throws SQLExecption, ClassNotFoundExeception{
Class.forName("org.postgresql.Driver");
String login = "log";
String mdp = "pass";
Connexion conn = DriverManager.getConnexion("jdbc:postgresql://localhost/"+log,log,mdp);
Statement st = conn.createStatement();
ResultSet resultat = st.executeQuery(s);
 
resultat.close();
st.close();
conn.close();
 
}
 
public static void main(String[] args) throws SQLException{
 
int j;
 
try{
for(j=0;j<5;j++){
   String z = "create table tab"+j+" (id int);";
   requete(z);
}
}
catch(Exception e){}
 
}
 
}
Le problème est que quand j'affiche mes tables crées je n'ai que la première table "tab0".

D'où peut venir ce problème, et comment le corriger ?

Merci d'avance.