Reputation: 154
I am creating a basic java application with Oracle database. I use Oracle SQL Developer to interact with oracle database.
I created tables and inserted data using Oracle SQL Developer and all operations were successful.But when I try to get those records in the java program, it does not get any results.
I debugged the java program and found out the issue is the resultset not getting any records from DB.(Other things are fine)
try {
stmt = dbConnector().createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println(rs.getString("AGE"));
}
} catch (SQLException e) {
e.printStackTrace();
Because of that, I tried to verify using SQL command line and it did not show the entries I entered using SQL developer. I cannot figure out what is wrong. Please refer the attached.
A help regarding this is much appreciated.
Upvotes: 0
Views: 1549
Reputation: 437
Please make sure that you have commit the transactions done in Oracle SQL Developer. Most probably that may be the reason for not showing records both in SQL plus & your java program.
You may commit by clicking on the commit button on Oracle SQL Developer toolbar (i.e. 6th button from left)
Upvotes: 3