I am trying to insert values into Ms access database .The table has 4 fields there is no primary key also the 4 fields are number type.When i am trying to execute the following java code using prepared statement:
DatabaseConnection dbcon=new DatabaseConnection();
Connection con=dbcon.dbconnection();
String query="INSERT INTO test2 VALUES(?,?,?,?)";
PreparedStatement ps= con.prepareStatement(query);
ps.setInt(1, 1);
ps.setInt(2, 2);
ps.setInt(3, 3);
ps.setInt(4, 4);
ps.executeUpdate();
Query executed successfully but table2 does not displays values.
There wasn’t any issue with Connection.
I Was not Closing ResultSet and Connection object thats why the Problem Occured.