簡體   English   中英

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

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

我嘗試在 netbeans 14 中制作桌面應用程序。因此,我嘗試將數據分類到 JTable 並使用 JTable 制作登錄屏幕。 我試圖通過 MSSQL 獲取數據。 為此,我下載了 jdbc 10.2.1,安裝它,添加了 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;用戶=m;密碼=150601"。 我怎樣才能解決這個問題? 我的代碼這個;

私人無效girisActionPerformed(java.awt.event.ActionEvent evt){
// TODO 在此處添加您的處理代碼: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);
    }

您是否將插件 jar 文件路徑添加到您的 IDE 中?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM