Ran_Macavity
Ran_Macavity

Reputation: 154

Oracle - Available data not visible in SQL Command Line/Java Program

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.

Oracle SQL Developer and SQL Command Line

A help regarding this is much appreciated.

Upvotes: 0

Views: 1549

Answers (1)

Damith
Damith

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

Related Questions