hi,im trying to connect to a access a MS Access database from which the knowledge i gained from Sun Java's tutorials. Although the select code works it seems that the following update statement doesn't work. The statement updates the data in the recordset but not in the database itself.
It is better to make mistakes now and on purpose than later and accidentally...
Mohamed Manas
Greenhorn
Joined: Jun 02, 2008
Posts: 24
posted
the code: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs=stmt.executeQuery("SELECT COF_NAME FROM COFFEES WHERE PRICE=7.99");
I would avoid using updateString/updateRow at all, not all databases support it. Instead, I'd recommend you write an update statement and execute it as a separate query.
Thank you for your review. Anyway I found out that I hadn't included the close() method for the connection after updating the resultset. Since I am a newbie I will make sure I will not make this kind of silly mistakes anymore.