简体   繁体   中英

SEVERE: null in java netbeans 14 java.sql.SQLException: No suitable driver found for error

I tried to make desktop apps in netbeans 14. So, I tried to sort the data into JTable and make a login screen with JTable. I tried to fetch the data via MSSQL. For this, I downloaded jdbc 10.2.1, installed it, added Tomcat. At first I was able to pull data properly and log in. but now " SEVERE: null I am getting error java.sql.SQLException: No suitable driver found for jdbc:sqlserver://DESKTOP-E480QRJ\sqlexpress:1433;databaseName=AracTrackingSystem;user=m;password=150601". How can I fix this? my code this;

private void girisActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: try {

        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
        String url=" jdbc:sqlserver://DESKTOP-E480QRJ\\sqlexpress:1433;databaseName=AracTakipSistemi;user=m;password=150601";
        //String KullaniciId=kullaniciid.getText();
        //String KullaniciSifre=sifre.getText();
        Connection con=DriverManager.getConnection(url);
        String sql="Select Kullanici from KullaniciId=? and KullaniciSifre=?";
        PreparedStatement pst= con.prepareStatement(sql);
        pst.setString(1, kullaniciid.getText());
        pst.setString(2, sifre.getText());
        ResultSet rs=pst.executeQuery();
        if(rs.next()){
            dispose();
            AracTakipIslemler2 n=new AracTakipIslemler2();
            n.setVisible(true);
        }
        else{
            
            JOptionPane.showMessageDialog(null, "eror");
            kullaniciid.setText("");
            sifre.setText("");
            con.close();
        }
    } catch (ClassNotFoundException | SQLException ex) {
        Logger.getLogger(AracTakipLogin2.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        Logger.getLogger(AracTakipLogin2.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        Logger.getLogger(AracTakipLogin2.class.getName()).log(Level.SEVERE, null, ex);
    }

Have you added the plugin jar file path to your IDE?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM