Answer to Question #229913 in Java | JSP | JSF for Nahid

Question #229913
Write a program to implement Simple Student database application using RMI. Remote client consist of GUI for performing di erent database operations (For ex. Insert, delete, update) and retrieving data through RMI.
1) output picture
2) code explanation
1
Expert's answer
2021-08-27T07:24:39-0400
import java.rmi.*;  
import java.rmi.server.*;  
import java.sql.*;  
import java.util.*;  
class StudentImpl extends UnicastRemoteObject implements Student{  
StudentImpl()throws RemoteException{}  
  
public List<MyStudent> getStudents(){  
List<MyStudent> list=new ArrayList<MyStudent>();  
try{  
Class.forName("oracle.jdbc.driver.OracleDriver");  
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle");  
PreparedStatement ps=con.prepareStatement("select * from customer400");  
ResultSet rs=ps.executeQuery();  
  
while(rs.next()){  
MyStudent s=new MyStudent();  
s.rollNo(rs.getInt(1));  
s.setFirstname(rs.getString(2));  
s.setLastname(rs.getString(3));  
s.setEmail(rs.getString(4));  
s.setFeeBal(rs.getFloat(5));  
list.add(s);  
}  
  
con.close();  
}catch(Exception e){System.out.println(e);}  
return list;  
}
}  

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS