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

Expert's answer

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!

LATEST TUTORIALS
APPROVED BY CLIENTS