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){}
}
} |
Partager