Hello
I am new to java and am having problem loading table numbers from mysql database to tablenumberJComboBox. I am using the load tablenumbers method.
private void loadTableNumbers()
{
// read all table numbers from database
try
{
// obtain all table numbers
myResultSet = myStatement.executeQuery(
"SELECT tableNumber FROM restaurantTables" );
// add numbers to tableNumberJComboBox
while ( myResultSet.next() == true )
{
tableNumberJComboBox.addItem(
String.valueOf( myResultSet.getInt(
"tableNumber" ) ) );
}
myResultSet.close(); // close myResultSet
} // end try
// catch SQLException
catch ( SQLException exception )
{
exception.printStackTrace();
}
} // end method loadTableNumbers
The following errors also appears when i run the code.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at Restaurant.<init>(Restaurant.java:101)
at Restaurant.main(Restaurant.java:709)