How to update data in the MySQ?
It is necessary to keep a real-time data and that calls to update data in the database. We modify values from rows and columns using the Update statement.
Here we shall explain on how to update data in MySQL from a java program
Update: Name Deepak
- If you have a simple employee table select it( in this video there is name and salary)
- Create a new java project, name it and click finish
- Right click the new java project and go to new folder option and select it and save it as lib
- Select the new java project and go to Java build path and select “Add JARS”
- A JAR selection folder pops up select new java project and under the lib select myseql-connector-java- and paste it
- Now click on src go to new and then select “Package”
- A new Java package folder pops up
- Name it with .jdbc extension
- Now select the name you created with.jdbc extension , right click and go to new and select class file
- Name the class file
- Tick the method options as public and click ok
- When the source code is ready, import all the JDBC library files
- Copy and paste the code required
- Make the necessary updates
- Create the statement option, mention the necessary update of the name of the employee
- Execute update
- Print the data as updated
- Close the statement and connection
- Run the code and check the data.
- If error-free your data update in MySQL was successful.
Here is the video tutorial of "How to update Data in a MySQL Database?":
For more information on JDBC and other database related operations, check our website at www.roseindia.net