Before i post my question,i tried all solutions but i can not resolve my problem.Can any one help me to find the solution ?
I m trying to get data from table "Email" but each time it invokes this exception
java.sql.SQLException: ResultSet is TYPE_FORWARD_ONLY at org.sqlite.jdbc4.JDBC4ResultSet.first(JDBC4ResultSet.java:402) at HMDao.EmailDao.FindString(EmailDao.java:144) at hmproject.StartingController.initialize(StartingController.java:103) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548) at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409) at hmproject.HMProject.start(HMProject.java:34) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863) at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326) at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$149(WinApplication.java:191)
This is my code :
public Email FindString(String ID) {
Email email = null;
String querySelectEmployer = "SElECT Email,Password FROM Email";
try {
ResultSet resultSet = Dbaconnection.getConnection().createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY).executeQuery(querySelectEmployer);
if (resultSet.first()) {
email = new Email(resultSet.getString("Email"), resultSet.getString("Password"));
}
resultSet.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
return email;
}