bonjour a tous je fais une application java qui va interagir avec un BD postgre lorsque je saisie ma requette dans postgre sa marche très bien:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
insert into "public"."Etudiant" (matricule,nom,prenom,sexe) values ('sefnvze','sdvre','zercze','vercd')
mais quand je me connecte en java avec eclipse pour insérer on me dit ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
DRIVER OK ! 
Connection effective !
org.postgresql.util.PSQLException: ERREUR: la relation « public.etudiant » n'existe pas
  Position*: 13
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2101)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1834)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:510)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:372)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
	at monpackage.ConectDB.main(ConectDB.java:25)
org.postgresql.util.PSQLException: ERREUR: la relation « public.etudiant » n'existe pas
  Position*: 13
voila mon code:
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
package monpackage;
import java.beans.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
import java.util.Enumeration;
import java.util.Properties;
 
public class ConectDB {
	public static void main(String[] args) {
 
		try {
			Class.forName("org.postgresql.Driver");
			System.out.println("DRIVER OK ! ");
 
			String url = "jdbc:postgresql://localhost:5432/Universite";
			String user = "postgres";
			String passwd = "keryjames";
 
			Connection conn = DriverManager.getConnection(url, user, passwd);
			System.out.println("Connection effective !");
 
			java.sql.Statement state=conn.createStatement();
			String req= "insert into public.Etudiant (matricule,nom,prenom,sexe) values ('sefnvze','sdvre','zercze','vercd')";
			state.executeQuery(req);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.print(e);
		}		
	}
}