Updating a jdbc with ms access
Work with Access databases from virtually anywhere through a standard ODBC Driver interface.ODBC is the most widely supported interface for connecting applications with data.I am trying to write a VERY basic front-end to an MS Access database.
Here are a few snippets of code to whet your appetite.I've tried using Prepared Statement and Statement implementations and I've used the execute() and execute Update() methods to no avail.Does anyone know why I don't get exceptions, I do get a return of 1 from execute Update() and the database is not altered? I am getting an error when I am using the update statement in my program. BOLD, 11)); Grid Bag Constraints gbc_btn Update = new Grid Bag Constraints(); gbc_btn Update.insets = new Insets(0, 0, 5, 5); gbc_btn Update.gridx = 3; gbc_btn Update.gridy = 3; content Pane.add(btn Update, gbc_btn Update); btn Visible(false); btn Action Listener(new Action Listener() ); update Mode_Of_Payment_Profile set Mode_Of_Payment_Profile_Type='mode'', Mode_Of_Payment_Profile_Description='FOO' , Mode_Of_Payment_Profile_Creation_Date='' where Mode_Of_Payment_Profile_ID='someid' The two adjacent single-quotes get treated as an escaped single-quote, so the parser thinks the literal string is "mode', Mode_Of_Payment_Profile_Description=", then it thinks the next token is whatever value you're passing in for Mode_Of_Payment_Profile_Description. "); String(1, get Modeof Payment Type); String(2, get Modeof Payment Description); String(3, currdate); String(4, get Mode ID); This way you don't have to do error-prone things like inserting arguments using string concatenation and handling the quoting yourself.If you were to replace use of String connect Params = "//F://eclipse_Luna_64_Development_Workspace//Project JAVA//LIC_AGENCY_TRACKER//DATABASE//LIC_DATA_TRACKER.accdb"; Connection connection = dbcon. It reduces the opportunities for SQL injection (since the Prepared Statement will look out for embedded escape characters) and is more readable.