Question: Name ( print ) : ID: 4 . The following is the login table in the database. Only one tuple in login right now.
Name print:
ID:
The following is the login table in the database. Only one tuple in login right now.
tableIDpasswordUser
If the following program is executed successfully, list all tuples in the login table, and give the output of the program.
import java.sql;
public class JDBCexample
public static void mainString args
try
f
Class.forNamesunjdbcodbc.JdbcOdbcDriver";
Connection conDriverManager.getConnectionjdbc:odbc:TESTJDBC";TESTJDBC is the data
source name
Statement st con.createStatement ;
String str"TESTJDBC";
stexecuteUpdateinsert into login valuesuserl'abcdef';
stexecuteUpdateinsert into login valuesuser;
PreparedStatement stmtcon.prepareStatementinsert into login valuesa;
stmtsetString "Tom";
stmtexecuteUpdate;
stmtsetString "Jerry";
stmtexecuteUpdate;
stexecuteUpdateupdate login set passwordstr where ID'Jerry";
ResultSet rsstexecuteQueryselect from login where password LIKE a;
String user;
String password;
while rsnext
userrsgetString;
passwordrsgetString;
System.out.printlnID: user password: password;
rsclose ;
stexecuteUpdatedelete from login where password LIKE ;
stclose;
stmtclose ;
con.close ;
catch Exception e
i
System.out.printlne;
a List tuples of login table in database after the above program is executed successfully. ID password
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
