Bonjour.
Je souhaite intégrer un timestamp dans une base de données HSQLDB. Pour cela je crée une classe test_OObase disposant de la méthode suivante :
Cette méthode est appelée dans la classe scrute_bases, ainsi :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 public int insertRecords(Date stamp, int num, String machine, String instance, int port, int sga, int taille, int nbdbf, int nbtemp, int arch, int arch_act, int nbarch, int volarch, int drapeau) { try { int Nblig = st.executeUpdate("INSERT INTO scrute_base (stamp, num, machine, instance, port, sga, taille, nbdbf, nbtemp, arch, arch_act, nbarch, volarch, drapeau) VALUES ('"+stamp+"','"+num+"', '"+machine+"', '"+instance+"', '"+port+"', '"+sga+"', '"+taille+"', '"+nbdbf+"', '"+nbtemp+"', '"+arch+"', '"+arch_act+"', '"+nbarch+"', '"+volarch+"', '"+drapeau+"')"); return Nblig; } catch(SQLException err) { System.err.println("\nERROR: Failed to insert records."); //err.printStackTrace(); return 0; } }
Java refuse en me disant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 Date stamp = new Date(); stamp.getTime(); System.out.println("Date : "+stamp); int val = hsqldb.insertRecords(stamp, boucle2, Tab_BDD[boucle2][0], Tab_BDD[boucle2][1], 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
"the method insertRecords (Date,int,String,String,int,int,int,int,int,int,int,int,int,int) in the type test_OObase in not applicable for the arguments (Date,int,String,String,int,int,int,int,int,int,int,int,int,int)
Je ne comprends pas. J'ai parfaite égalité entre le nombre d'arguments et leur type.
Est-ce un problème de format de date ?
Je suis en Eclipse 3.2.2 avec une jre1.5.0_06
Merci pour votre aide.
Théophanie
Partager