If you encounter the jdbc driver not found error in netbeans in spite of your jdbc code being absolutely flawless and the following type of error appears:-


com.mysql.jdbc.Driver

No suitable driver found for jdbc:mysql://localhost:3306/mydb


Then the solution that will fix this problem in netbeans is as follows:-
  • First select a project in which this error has occured, right click on it and choose properties.

  • Now in the categories window choose libraries, select compile tab, click on add library button, browse for the jdbc driver for your database, click on the add library button to add the library (in this case the jdbc driver) and then press ok. For example, in case you are using MYSQL database then browse and select the MYSQL database driver as shown in the figure below.




















  • Now the last step is to recompile the code and your code will run without the "no suitable driver found error"