Salve a tutti.Ho un problema con la connessione JDBC ad un database mySql.
codice:
public class ConnectionMySql implements IConnectionService{
boolean b;
Connection conn;
public boolean getStatus(){
try{
// Carico il driver JDBC per la connessione con il database server MySQL
Class.forName("com.mysql.jdbc.Driver");
//Mi connetto al server Mysql
conn=DriverManager.getConnection("jdbc:mysql://localhost/", "root", "");
b=true;
}catch (ClassNotFoundException e){
System.out.println(e.getMessage());
b=false;
}catch (SQLException e){
System.out.println(e.getMessage());
b=false;
}catch(Exception e){
System.out.println(e.getMessage());
b=false;
}
return b;
}
public boolean start(){
try {
Process process = Runtime.getRuntime().exec("net start MySql4");
b=true;
}catch (Exception ie) {
b=false;
}
return b;
}
public boolean stop(){
try {
Process process = Runtime.getRuntime().exec("net stop MySql4");
b=true;
}catch (Exception ie) {
b=false;
}
return b;
}
}
Il problema mi chiama errore credo su getConnection().Ecco le eccezione ke mi solleva:
codice:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.mysql.jdbc.ConnectionImpl.<clinit>(ConnectionImpl.java:213)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(DriverManager.java:567)
at java.sql.DriverManager.getConnection(DriverManager.java:181)
at agspit.ConnectionMySql.getStatus(ConnectionMySql.java:33)
at agspit.ControllerAgSpit.actionPerformed(ControllerAgSpit.java:123)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1982)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2305)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:377)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:232)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1137)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1178)
at java.awt.Component.processMouseEvent(Component.java:5979)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3284)
at java.awt.Component.processEvent(Component.java:5744)
at java.awt.Container.processEvent(Container.java:1984)
at java.awt.Component.dispatchEventImpl(Component.java:4387)
at java.awt.Container.dispatchEventImpl(Container.java:2042)
at java.awt.Component.dispatchEvent(Component.java:4217)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4246)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3910)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3840)
at java.awt.Container.dispatchEventImpl(Container.java:2028)
at java.awt.Window.dispatchEventImpl(Window.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4217)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Qual'è il porblema??GRAZIE