I'm having a problem with a query in my java application. It's a simple query to get a users score based on their name, however, I am constantly getting an error and can't spot where the problem is coming from.
String driver = "com.mysql.jdbc.Driver"; Class.forName(driver).newInstance(); con = DriverManager.getConnection(url, USERNAME, PASSWORD); st = con.createStatement(); PreparedStatement preStatement = con.prepareStatement("select score from playerscore where name=?"); preStatement.setString(1, "tomcat"); ResultSet resultSet = preStatement.executeQuery(); score = resultSet.getInt(1); Could someone cast an eye and point me in the right direction?
EDIT: Image of stack trace