Je veux faire des PrepareStatement en java, mais je sais pas quoi initialiser pour cela fonctionne.
L'erreur est dans le main
Voici
Il me manque quelque chose, mais je ne sais pas quoi ?
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
32
33
34
35
36
37
38
39
40
41
42 public class Exercice2 { static Connection con; public static void connecter(){ String user = null; String pw = null; String url = null; Properties p = new Properties(); BufferedInputStream bis = null; try{ bis = new BufferedInputStream(new FileInputStream("propertie.txt")); p.load(bis); url = p.getProperty("url"); user = p.getProperty("user"); pw = p.getProperty("pw"); bis.close(); }catch (IOException e){ e.printStackTrace(); } try{ Class.forName("oracle.jdbc.OracleDriver"); con = DriverManager.getConnection(url, user, pw); }catch(SQLException e){ System.err.println("Connection Impossible"); e.printStackTrace(); }catch(ClassNotFoundException e){ System.err.println("ClassNotFoundExceptio(problèmes de driver?)"); } } public static void main(String[] args) { PreparedStatement prep1 = con.prepareStatement(""); } }
Partager