Bonjour , je n'arrive pas me connecter a ma BDD , pourtant je n'ai aucune erreur quelque warnings comme :
Classpath entry ***/mysql-connector-java-5.1.12/mysql-connector-java-5.1.12-bin.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.
Classpath entry eclipse.fproj.jdt.libprov.osgi/jpt.jpa is marked for publish/export but is not exported on the project classpath. Classpath visibility within Eclipse and at runtime will differ
No connection specified for project. No database-specific validation will be performed.
Projects must be referenced by an EAR or a WAR to use classpath publish/export dependencies whose runtime path (../) maps into the parent component.
The serializable class NewJFrame does not declare a static final serialVersionUID field of type long
Je pense que c'est lié au warnings mais je suis pas sur , je comprend rien.
voici mon code au cas ou . Merci
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
43
44
45
46
47
48
49
50 import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Date; import com.mysql.jdbc.Connection; public class Mysql { private Connection connexionBDD() { Connection conn = null; try { Class.forName("projet"); conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/projet","root","*****"); } catch (Exception e) { System.out.println("echec connection : "+e); } return conn ; } public void Erreur(String erreur) { Connection co = connexionBDD(); try { Date date= new Date(); erreur="test"; Statement state = co.createStatement(); ResultSet result=state.executeQuery("INSERT INTO erreur Values ('"+erreur+"','"+date+"')"); result.last(); } catch (Exception e) { System.out.println("Erreur avec le insert : "+e+")"); } try { co.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Partager