Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 从链接到数据库的组合框中删除id时出错_Mysql_Javafx_Combobox - Fatal编程技术网

Mysql 从链接到数据库的组合框中删除id时出错

Mysql 从链接到数据库的组合框中删除id时出错,mysql,javafx,combobox,Mysql,Javafx,Combobox,我有一个错误我已经工作了两周了但我还是被阻止了, 因此,我有一个组合框与我的数据库完美链接,我有一个场景,在这个场景中,我从组合框中选择一个Id,然后我有一个从数据库中删除我的Id的函数 但我有一个连接错误: nov. 24, 2020 3:26:05 PM application.MainController getId SEVERE: null java.sql.SQLNonTransientConnectionException: No operations allowed aft

我有一个错误我已经工作了两周了但我还是被阻止了, 因此,我有一个组合框与我的数据库完美链接,我有一个场景,在这个场景中,我从组合框中选择一个Id,然后我有一个从数据库中删除我的Id的函数 但我有一个连接错误:

    nov. 24, 2020 3:26:05 PM application.MainController getId
SEVERE: null
java.sql.SQLNonTransientConnectionException: No operations allowed after connection closed.
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:73)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:1667)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:1583)
    at application.MainController.getId(MainController.java:203)
    at application.MainController.initialize(MainController.java:91)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
    at application.MainController.allegementCode(MainController.java:104)
    at application.MainController.valide(MainController.java:130)
    at application.MainController.supprimerValide(MainController.java:284)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
    at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1782)
    at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8879)
    at javafx.controls/javafx.scene.control.Button.fire(Button.java:200)
    at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
    at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
    at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
    at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
    at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
    at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: com.mysql.cj.exceptions.ConnectionIsClosedException: No operations allowed after connection closed.
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at mysql.connector.java@8.0.22/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
    at mysql.connector.java@8.0.22/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
    at mysql.connector.java@8.0.22/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
    at mysql.connector.java@8.0.22/com.mysql.cj.NativeSession.checkClosed(NativeSession.java:1171)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:576)
    at mysql.connector.java@8.0.22/com.mysql.cj.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:1598)
    ... 72 more

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1787)
    at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8879)
    at javafx.controls/javafx.scene.control.Button.fire(Button.java:200)
    at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
    at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
    at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
    at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
    at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
    at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
    at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
    at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
    at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
    at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1782)
    ... 47 more
Caused by: javafx.fxml.LoadException: 
/E:/IUT/anne2/GestionSalles/Projet(Guilhem)/bin/inter/Inside.fxml

    at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
    at application.MainController.allegementCode(MainController.java:104)
    at application.MainController.valide(MainController.java:130)
    at application.MainController.supprimerValide(MainController.java:284)
    ... 58 more
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Collection.iterator()" because "c" is null
    at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:335)
    at javafx.base/javafx.collections.ModifiableObservableListBase.addAll(ModifiableObservableListBase.java:99)
    at javafx.base/javafx.collections.FXCollections.observableArrayList(FXCollections.java:356)
    at application.MainController.initialize(MainController.java:91)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
    ... 68 more
据我所知,我的方法getId()有一个错误

这里是“supprimerSalle()方法”


我真的希望你能帮我用下面的方法添加连接

public static boolean supprimerSalle (String lenom) {

boolean execution = true;

//Add Connection statement here
Connection connect = null;

requete ="DELETE FROM t_ordinateurs WHERE t_ordinateurs.nom = '" + lenom + "';";            
try {

//Initialize connection here
connect = DriverManager.getConnection(  
"jdbc:mysql://localhost:3306/sonoo","root","root");  
   
Statement  stm=connect.createStatement();           // Etablissement du statement
    stm.executeUpdate (requete);                        // Ouverture de la connexion et exécution
    stm.close();                                        // de la requete
    connect.close();                                    // fermeture de la connexion

} catch (Exception e) {
    execution = false;
}

connect = Connexion.getConnection();

requete ="DELETE FROM t_salles WHERE t_salles.nom = '" + lenom + "';";          
try {
    Statement  stm=connect.createStatement();           // Etablissement du statement
    stm.executeUpdate (requete);                        // Ouverture de la connexion et exécution
    stm.close();                                        // de la requete
    connect.close();                                    // fermeture de la connexion

} catch (Exception e) {
    execution = false;
}

return execution;
}

Connexion.getConnection()
返回的
连接已关闭。问题在于
Connexion
类(或者可能是代码中的其他部分,如果您打算重用某个连接,但意外地在某个地方关闭了该连接)。@James\u D是的,我最终更正了它谢谢:D
/**
 * 
 * @param index
 * @throws Exception 
 */
public void supprimerValide(ActionEvent index) throws Exception {
    String selected = idCombo.selectionModelProperty().toString();
    SalleDAO.supprimerSalle(selected);  
    valide(index);      
}
/**
 * Supprime une salle :
 * Supprime dans t_ordinateur puis dans t_salles
 * peu importe si c'est une salle ordi ou non
 * 
 * 
 * 
 * TODO : Vérifier si la salle est une salle ordinateur ou non
 * Supprime dans t_ordinateur puis dans t_salles si oui
 * Supprime dans t_salles directement sinon
 * Possibilite : Utilisé le EXIST dans la requete SQL ?
 * 
 * 
 * @param lenom         Nom de la salle a supprimer
 * @return
 */
public static boolean supprimerSalle (String lenom) {

    boolean execution = true;
    //  if () {                                 // Expression a trouver
    //connect = Connexion.getConnection();

    requete ="DELETE FROM t_ordinateurs WHERE t_ordinateurs.nom = '" + lenom + "';";            
    try {
        Statement  stm=connect.createStatement();           // Etablissement du statement
        stm.executeUpdate (requete);                        // Ouverture de la connexion et exécution
        stm.close();                                        // de la requete
        connect.close();                                    // fermeture de la connexion

    } catch (Exception e) {
        execution = false;
    }

    connect = Connexion.getConnection();

    requete ="DELETE FROM t_salles WHERE t_salles.nom = '" + lenom + "';";          
    try {
        Statement  stm=connect.createStatement();           // Etablissement du statement
        stm.executeUpdate (requete);                        // Ouverture de la connexion et exécution
        stm.close();                                        // de la requete
        connect.close();                                    // fermeture de la connexion

    } catch (Exception e) {
        execution = false;
    }

    return execution;
}
public static boolean supprimerSalle (String lenom) {

boolean execution = true;

//Add Connection statement here
Connection connect = null;

requete ="DELETE FROM t_ordinateurs WHERE t_ordinateurs.nom = '" + lenom + "';";            
try {

//Initialize connection here
connect = DriverManager.getConnection(  
"jdbc:mysql://localhost:3306/sonoo","root","root");  
   
Statement  stm=connect.createStatement();           // Etablissement du statement
    stm.executeUpdate (requete);                        // Ouverture de la connexion et exécution
    stm.close();                                        // de la requete
    connect.close();                                    // fermeture de la connexion

} catch (Exception e) {
    execution = false;
}

connect = Connexion.getConnection();

requete ="DELETE FROM t_salles WHERE t_salles.nom = '" + lenom + "';";          
try {
    Statement  stm=connect.createStatement();           // Etablissement du statement
    stm.executeUpdate (requete);                        // Ouverture de la connexion et exécution
    stm.close();                                        // de la requete
    connect.close();                                    // fermeture de la connexion

} catch (Exception e) {
    execution = false;
}

return execution;
}