Hello,

When I run the project using my localhost, everything works fie. But when I use an other server I get this error:
No suitable driver found for jbdc:mysql://

    public void populateList2() {
        Connection con = null;

        Properties conProps = new Properties();
        conProps.setProperty("user", "abn859");
        conProps.setProperty("password", "100011399");

        try {
            con = DriverManager.getConnection("jbdc:mysql://myserver/dbName", conProps);
            String sql = ("SELECT sID,Name, Surname,Nationality, Duration, Price, Stage, Teacher, Pay1, Pay2, Pay3, Pay4, Pay5, Pay6, Pay7, Pay8, Pay9, Pay10,Pay11 FROM Students");
            st = (com.mysql.jdbc.PreparedStatement) con.prepareStatement(sql);
            st.executeQuery();

            rs = st.getResultSet();
            Table_Stud.setModel(DbUtils.resultSetToTableModel(rs));

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

then check there is no duplication, that deployed project war file contains one and also Java container (server) has another one. In both cases they should be stored in lib folders like MY_PROJECT/lib and TOMCAT/lib

Assuming all the connection details are correct, I would load a database browser like SQL Workbench and see if you can access the tables independently of the Java code.

Edited 3 Years Ago by Starstreak

An important thing, not directly related to your question, but related to connecting to databases from an application in general is that you shouldn't hard-code the connection details into the application.
It would be an improvement to store the database connection parameters in say, a configuration file, for example.

Edited 3 Years Ago by mvmalderen

This question has already been answered. Start a new discussion instead.