-1

Can somebody help me, program working fine, but still I get this error. When I run the program it keeps saying;

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/geckoboard

public class DBConnection {

    public static Connection conn;
    public Statement statement;
    public ResultSet rs;

    public static Connection setDBConnection() throws SQLException {

        String databaseServer = PropertiesService.getDatabaseServer();
        String databasePort = PropertiesService.getDatabasePort();
        String databaseUsername = PropertiesService.getDatabaseUsername();
        String databasePassword = PropertiesService.getDatabasePassword();
        String databaseDatabase = PropertiesService.getDatabaseDatabase();

        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://" + databaseServer
                    + ":" + databasePort + "/" + databaseDatabase,
                    databaseUsername, databasePassword);
        } catch (ClassNotFoundException e) {
            System.out.println(e);
        }
        return conn;
    }

    public ResultSet getResultSet(String sqlQuery, Connection conn)
            throws SQLException {

        System.out.println(sqlQuery);
        String sqlquery = sqlQuery;
        // conn = conn;
        try {

            statement = conn.createStatement();
            rs = statement.executeQuery(sqlquery);
        } catch (SQLException se) {
            System.out.println(se);
        } finally {
            rs.close();
            conn.close();
        }
        return rs;
    }
}
Vivek Singh
  • 2,047
  • 11
  • 24

1 Answers1

0

Try putting the driver jar in the server lib folder.

   $CATALINA_HOME/lib
Abdelhak
  • 8,299
  • 4
  • 22
  • 36