have to make an SQL Java Database. webdaxlpid-12771371-dt-content-rid-89561 4 Delete a student S. Register a counse 7. Check student egstration 8 Uplond grades 9.Check gale prop table Registered; op table student; reate table Student address varchar (100), mafor char (10) eate table course code char (10) primary key title varchar C reate table Registered code char(a0). senester char (10), preign Key ssn) reférences student (ssa) foreign key (code) references prinary key (ssn,code.year,senester) tnsert into Student values (555550001, "Ton Harks" 100 11en st.. Spartarburg, Sc 29301 CIS Spartanburg, sC 2930 mert into course valuessz0 computer science 1"1 13% tnme course values C350 Analysis of algorithas 50005, MATH C350" 203 spr ing SAMSUNG mport java.io. public class JDBCORACLE eparam args the command line arguments public statie void main (Stringtl arga) throws SQLException, IOException CEY Class.forName ("oracle.jdba.driver.OracleDrivez"): I/Load the Oracle JDBC driver catch (ClasaNotFoundExcersion e) System.out.printin("Could not load the driver") try //eonneet to oracie and validate the user and pasad String Oracleuser,Oraclepass: Oracleaser readEntry("Orscle username: oraclepass readEntry ("Oracle Passvord: " String url-jdbe:oracleithin:8tedoral.uscupstate. edu:1521xe a Connection conn -DriverManager.getConnection (url,Oracieuser, Oraciepasa) /connect oracle Statement st-conn.createStatesent st.executeopdatedelete from login") at executelpdate ("insert into Jogin values(ue 123156) ): at.executeopdate(insert imnto login valuesuner?, *3234569 ResultSet r-gt.executeQuezy( select rom login") Sering er-* String password while (ES DexE 0) s.getstring (2)2 password-zs.getsering(2) ystem.out-peintin"D passvord s t close h catch (Exeeptione Syacem.err-printin(e.getMeasage 0 SAMSUNG NC191 System.out printin("ID:"+user +* pansvordpword) : rs.close at.close conn.close catch (Exception e) Systen.err printin(e.getHessage )) Urility funetion to read a line from standard inpat static String readEntry (String prompt SeringBuffer batter new Stringbuttero System.out-print (prompt) System.out.Fluah int -System.in.read) butter.append ((char)e) System.in.read) return buffer.toStringo.trinD cateh (IOException e SAMSUNG webdaxlpid-12771371-dt-content-rid-89561 4 Delete a student S. Register a counse 7. Check student egstration 8 Uplond grades 9.Check gale prop table Registered; op table student; reate table Student address varchar (100), mafor char (10) eate table course code char (10) primary key title varchar C reate table Registered code char(a0). senester char (10), preign Key ssn) reférences student (ssa) foreign key (code) references prinary key (ssn,code.year,senester) tnsert into Student values (555550001, "Ton Harks" 100 11en st.. Spartarburg, Sc 29301 CIS Spartanburg, sC 2930 mert into course valuessz0 computer science 1"1 13% tnme course values C350 Analysis of algorithas 50005, MATH C350" 203 spr ing SAMSUNG mport java.io. public class JDBCORACLE eparam args the command line arguments public statie void main (Stringtl arga) throws SQLException, IOException CEY Class.forName ("oracle.jdba.driver.OracleDrivez"): I/Load the Oracle JDBC driver catch (ClasaNotFoundExcersion e) System.out.printin("Could not load the driver") try //eonneet to oracie and validate the user and pasad String Oracleuser,Oraclepass: Oracleaser readEntry("Orscle username: oraclepass readEntry ("Oracle Passvord: " String url-jdbe:oracleithin:8tedoral.uscupstate. edu:1521xe a Connection conn -DriverManager.getConnection (url,Oracieuser, Oraciepasa) /connect oracle Statement st-conn.createStatesent st.executeopdatedelete from login") at executelpdate ("insert into Jogin values(ue 123156) ): at.executeopdate(insert imnto login valuesuner?, *3234569 ResultSet r-gt.executeQuezy( select rom login") Sering er-* String password while (ES DexE 0) s.getstring (2)2 password-zs.getsering(2) ystem.out-peintin"D passvord s t close h catch (Exeeptione Syacem.err-printin(e.getMeasage 0 SAMSUNG NC191 System.out printin("ID:"+user +* pansvordpword) : rs.close at.close conn.close catch (Exception e) Systen.err printin(e.getHessage )) Urility funetion to read a line from standard inpat static String readEntry (String prompt SeringBuffer batter new Stringbuttero System.out-print (prompt) System.out.Fluah int -System.in.read) butter.append ((char)e) System.in.read) return buffer.toStringo.trinD cateh (IOException e SAMSUNG
-
Engineering 2022-05-15 19:04:59