Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error in my code??

843859Apr 16 2006 — edited Apr 16 2006
- I cant figure out wheres my error coz NetBeans 5.0 states Exceptionjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
Can someone here please check for me.. My presentation to my course supervisor is this Thursday.. Heres my code. Cheers mate!

********************************************************************
private void bttn_updateActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{

Connection con=null;
Statement sm=null;
ResultSet rs = null;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:Estate");
sm = con.createStatement();

sm.executeUpdate("UPDATE RealEstateOffice " +
"SET officeNumber = ' " + oNo.getText() + "'," +
"name = ' " + oName.getText() + "'," +
"officeManagerName = ' " + oManager.getText() + "'," +
"address = ' " + oAdd.getText() + "'," +
"phone = ' " + oPhone.getText() + "'," +
"fax = ' " + oFax.getText() + "'," +
"WHERE officeNumber = ' " + oNo.getText() + "' ");

rs.close();
sm.close();
con.close();
}
catch(Exception e){
System.out.println("Exception"+e);
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 14 2006
Added on Apr 16 2006
6 comments
78 views