Java updating resultset

by  |  06-Feb-2020 18:59

Copy and past the following example in JDBCExample.java, compile and run as follows − java JDBCExample Connecting to database... ID: 100, Age: 38, First: Zara, Last: Ali ID: 101, Age: 45, First: Mahnaz, Last: Fatma ID: 102, Age: 55, First: Zaid, Last: Khan ID: 103, Age: 50, First: Sumit, Last: Mittal Inserting a new record... ID: 100, Age: 38, First: Zara, Last: Ali ID: 101, Age: 45, First: Mahnaz, Last: Fatma ID: 102, Age: 55, First: Zaid, Last: Khan ID: 103, Age: 50, First: Sumit, Last: Mittal ID: 104, Age: 40, First: John, Last: Paul List the record before deleting...

java updating resultset-48

Sun's, and James Gosling's, * pioneering role in inventing and promulgating (and standardizing) the Java * language and environment is gratefully acknowledged.

* * The pioneering role of Dennis Ritchie and Bjarne Stroustrup, of AT&T, for * inventing predecessor languages C and C is also gratefully acknowledged.

Could I iterate through this result set and update Col4 in Table B?

That is, using the JDBC/Result Set update X(...) methods?

For example- result String("Column Name");, result Int("Column Name");, You can update the database table from the result Set object as - Statement statement = connection.create Statement( Result Set. CONCUR_UPDATABLE); result Set.first(); // Setting the updating String result Set.update String("Name", "vnay"); // Updating the first row result Set.update Row(); An Example given below illustrate the above explanations, At first create database named student and then create a table student in the student database as CREATE TABLE student ( Roll No int(9) PRIMARY KEY NOT NULL, Name tinytext NOT NULL, Course varchar(25) NOT NULL, Address text ); Then insert the value into it as NSERT INTO student VALUES(1, ' Ram', ' B.

Community Discussion