JDBC commit problem
- From: mark <mkazmierski@xxxxxxxxx>
- Date: Tue, 12 Jun 2007 07:14:53 -0700
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
.
- Follow-Ups:
- Re: JDBC commit problem
- From: Robert Klemme
- Re: JDBC commit problem
- Prev by Date: EJB3.0 Entities and database password control
- Next by Date: Re: JDBC commit problem
- Previous by thread: EJB3.0 Entities and database password control
- Next by thread: Re: JDBC commit problem
- Index(es):
Relevant Pages
|