I am working on eclipse and using sqlite as database on windows 10 64 bit operating system. Now when i try to get all values from my database it shows the message that there is no such table but the connection is being established. What should i do??
try {
Class.forName("org.sqlite.JDBC");
conn=DriverManager.getConnection("jdbc:sqlite:C://Users//APARAJIT//Desktop//Projects//kbcc.sqlite");
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"can't open database");
}
try {
Statement stmt = mycon.createStatement();
String sql = "SELECT * FROM record";
PreparedStatement pst = mycon.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
rs.close();
pst.close();
stmt.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(frame, e);
}
Please copy your database file to your project folder.
I faced the same error. The reason for that error is because of my sqlite database file being in my src
folder. When I move it from my src
folder to my project folder, my error is solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With