Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Eclipse MySQLSyntaxErrorException
    primarykey
    data
    text
    <p>I'm trying to get some car lists from my database ,but somehow I keep getting this error <code>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Make' in 'field list'</code>and I spent more then enough time figuring it out so I'm trying to find an answer here.</p> <p>Adapter class:</p> <pre><code>import java.sql.SQLException; public class DatabaseAdapter2 { public CarList getAllCars() { MyDatabase myDB = new MyDatabase(); CarList cars = new CarList(); try { myDB.openMySQLDatabase("db", "root", ""); String sql = "SELECT Make, Model, LicenseNumber, Color, Year," + "HorsePower, TimeUntilService, ConsumptionPerKm," + "NumberOfSeats, NumberOfDoors, Transmission, ClimateControl, Price" + "FROM cars"; Object[][] result = myDB.returnSQLQueryResult(sql); for (int i = 0; i &lt; result.length; i++) { for (int j = 0; j &lt; result.length; j++) { String make = (String) result[i][j]; String model = (String) result[i][j]; String licenseNumber = (String) result[i][j]; String color = (String) result[i][j]; int year = (int) result[i][j]; String horsePower = (String) result[i][j]; String timeUntilService = (String) result[i][j]; String consumptionPerKm = (String) result[i][j]; int numberOfSeats = (int) result[i][j]; int numberOfDoors = (int) result[i][j]; String transmission = (String) result[i][j]; String climateControl = (String) result[i][j]; int price = (int) result[i][j]; cars.add(new Car(make, model, licenseNumber, color, year, horsePower, timeUntilService, consumptionPerKm, numberOfSeats, numberOfDoors, transmission, climateControl, price)); } } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { try { myDB.closeDatabase(); } catch (SQLException e) { e.printStackTrace(); } } return cars; } } </code></pre> <p>The Database itself: <a href="http://imgur.com/2L3mY6a" rel="nofollow">http://imgur.com/2L3mY6a</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload