Hello,
I am working with MS Access database through JDBC. My application
allows to insert new data to the database and to view its contents.
The problem arises when I want to view my table just after inserting
new data, because then I do not see new row (but when I close and open
again the application, the new row exists... and just after inserting
when I open MS Access I also see it).
My code:
// inserting new data
PreparedStatement stnt = conn.prepareStatement("INSERT INTO Addresses
(name, value, prize, date) VALUES (?,?,?,?)");
stnt.setString(1, name);
stnt.setDouble(2, value);
stnt.setDouble(3, prize);
stnt.setDate(4, sqlDate);
stnt.executeUpdate();
conn.commit();
stnt.close();
// viewing data
ResultSet rs = null;
Statement stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM Addresses");
while(rs.next()) {
// displaying
}
rs.close()
stmt.close();
Any ideas??
Regards, mark
Robert Klemme - 12 Jun 2007 15:31 GMT
> Hello,
>
[quoted text clipped - 4 lines]
> again the application, the new row exists... and just after inserting
> when I open MS Access I also see it).
That's probably more of an Access issue than an JDBC issue.
> My code:
>
[quoted text clipped - 8 lines]
> conn.commit();
> stnt.close();
I'd swap the two lines above.
> // viewing data
> ResultSet rs = null;
[quoted text clipped - 5 lines]
> rs.close()
> stmt.close();
Kind regards
robert