Bonjour, j'arrive pas a faire la connection avec ma base de donnee et j'ai une reponse comme ceci
run:
7 août 2012 12:01:55 JCalendar$2 actionPerformed
GRAVE: null
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at JCalendar$2.actionPerformed(JCalendar.java:110)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6290)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6055)
at java.awt.Container.processEvent(Container.java:2039)
at java.awt.Component.dispatchEventImpl(Component.java:4653)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
at java.awt.Container.dispatchEventImpl(Container.java:2083)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:621)
at java.awt.EventQueue$2.run(EventQueue.java:619)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
7 août 2012 12:01:55 JCalendar$2 actionPerformed
GRAVE: null
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/med_consul
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at JCalendar$2.actionPerformed(JCalendar.java:116)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6290)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6055)
at java.awt.Container.processEvent(Container.java:2039)
at java.awt.Component.dispatchEventImpl(Component.java:4653)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
at java.awt.Container.dispatchEventImpl(Container.java:2083)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:621)
at java.awt.EventQueue$2.run(EventQueue.java:619)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at JCalendar$2.actionPerformed(JCalendar.java:124)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6290)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6055)
at java.awt.Container.processEvent(Container.java:2039)
at java.awt.Component.dispatchEventImpl(Component.java:4653)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
at java.awt.Container.dispatchEventImpl(Container.java:2083)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:621)
at java.awt.EventQueue$2.run(EventQueue.java:619)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
BUILD SUCCESSFUL (total time: 9 seconds)
private GregorianCalendar _calendar = new GregorianCalendar();
private DateFormatSymbols _dateSymbols = new DateFormatSymbols();
private SimpleDateFormat _formatMY = new SimpleDateFormat("MMMM yyyy");
private int _firstDayOfWeek = _calendar.getFirstDayOfWeek();
private final JLabel _monthYear = new JLabel("", SwingUtilities.CENTER);
private final JLabel[] _daysOfWeek = new JLabel[7];
private final JButton[] _daysNumber = new JButton[42];
private final ActionListener _changeMonth = new ActionListener() {
public void actionPerformed(final ActionEvent ae) {
final int nb = "next".equals(ae.getActionCommand()) ? 1: -1;
_calendar.add(Calendar.MONTH, nb);
updateMonthYear();
updateDaysNumber();
}
};
public JCalendar() {
setLayout(new BorderLayout());
// Month Panel
final JPanel monthPanel = new JPanel();
final JButton previous = new JButton("<<");
previous.addActionListener(_changeMonth);
final JButton next = new JButton(">>");
next.addActionListener(_changeMonth);
next.setActionCommand("next");
_monthYear.setPreferredSize(new Dimension(320, 120));
monthPanel.add(previous);
monthPanel.add(_monthYear);
monthPanel.add(next);
add(monthPanel, BorderLayout.NORTH);
// Day Panel
final JPanel dayPanel = new JPanel();
dayPanel.setLayout(new GridLayout(7, 7));
for (int i = 0; i < 7; ++i)
dayPanel.add(_daysOfWeek[i] = new JLabel(" ", SwingUtilities.CENTER));
for (int i=0; i<_daysNumber.length; ++i)
{
//fenetre de confirmation du jour
_daysNumber[i] = new JButton();
_daysNumber[i].addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
JOptionPane jop = new JOptionPane(), jop2 = new JOptionPane();
String nom = (String)jop.showInputDialog(null,"Choisissez un creneau pour " ,"RDV ",JOptionPane.QUESTION_MESSAGE,
null,jm,jm[0]);
if ((nom.equals("Matin"))||(nom.equals("Soir")))
{
jop2.showMessageDialog(null, "Votre disponibilite est le " + nom, "RDVvali", JOptionPane.INFORMATION_MESSAGE);
// Remplissage des composants
updateMonthYear();
updateDaysOfWeek();
updateDaysNumber();
}
// Réactualise la locale et réaffiche le contenu des composants
private void updateLocale(final Locale locale) {
_locale = locale;
final Date tmp = _calendar.getTime();
_calendar = new GregorianCalendar(_locale);
_calendar.setTime(tmp);
_firstDayOfWeek = _calendar.getFirstDayOfWeek();
_dateSymbols = new DateFormatSymbols(_locale);
_formatMY = new SimpleDateFormat("MMMM yyyy", _locale);
updateMonthYear();
updateDaysOfWeek();
updateDaysNumber();
}
// Affiche le mois et l'année en cours
private void updateMonthYear() {
_monthYear.setText(_formatMY.format(_calendar.getTime()));
}
// Affiche les jours de la semaine
private void updateDaysOfWeek() {
final String[] weekDays = _dateSymbols.getShortWeekdays();
for (int i = 1; i < weekDays.length; ++i) {
final int index = (i - 2 + _firstDayOfWeek) % 7 + 1;
_daysOfWeek[i - 1].setText(weekDays[index]);
}
}
// Affiche le numéro des jours
private void updateDaysNumber() {
//apparition des marches dans le mois
String var ="";
int M1 = 2;
int M2 = 3;
int M3 = 4;
int M4 = 6;
final Date tmp = _calendar.getTime();
_calendar.set(Calendar.DAY_OF_MONTH, 1);
final int firstDay = _calendar.get(Calendar.DAY_OF_WEEK);
final int LocalFirstDay = (firstDay - _firstDayOfWeek + 7) % 7 + 1;
boolean full = false;
for (int i = 0; i < _daysNumber.length; ++i) {
//Détermine si le composant est affiché ou non
final boolean isNotEmpty = i < LocalFirstDay - 1 || full;
_daysNumber[i].setVisible(!isNotEmpty);
// Affichage du jour
if (!isNotEmpty) {
final int dayOfMonth = _calendar.get(Calendar.DAY_OF_MONTH);
//apparitions et frequences des marches
if (dayOfMonth == M1)
{
var = var +"A";
M1 +=3;
}
if (dayOfMonth == M2)
{
var = var +"B";
M2 +=4;
}
if (dayOfMonth == M3)
{
var = var + "C";
M3 +=5;
}
if (dayOfMonth == M4)
{
var = var + "D";
M4 +=7;//frequences ....
}
_daysNumber[i].setText(String.valueOf(dayOfMonth)+var);
var = "";//retourne vide apres chaque execution
_calendar.add(Calendar.DAY_OF_MONTH, 1);
full = 1 == _calendar.get(Calendar.DAY_OF_MONTH);
}
}
_calendar.setTime(tmp);
}
public static void main(final String[] args)
throws SQLException {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JFrame frame = new JFrame("Prog Doc ");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JCalendar());
frame.pack();
frame.setVisible(true);
}
});
}
}
je veux juste enregistere dans ma base mysql RDV ,Jour du marche et disponibilite
j'ai besoin d'aide je palnche dessus depuis 3 semaines
merci d'avance
youkc
Messages postés46Date d'inscriptionlundi 14 mars 2011StatutMembreDernière intervention15 août 20123 7 août 2012 à 14:35
voici deux liens :
1: intégrer le pilote a ton projet = http://esp-codesources.lenyx.org/?p=166
2: connexion a la base de donnée = http://esp-codesources.lenyx.org/?p=175
merci pour le coup de main je viens de visiter les liens ma question suivante est donc je dois mettre apres mon main le code qui permet de me connecter a la base ? sinon si tu peux m'indiquer une autre facon de proceder directement dans mon code ceci me ferait vraiment plaisir je suis en ligne .