Answer to Question #230269 in Java | JSP | JSF for qkisdndf

Question #230269

How do we provide security to RMI classes? Write a program to implement Simple Student database application using RMI. Remote client consist of GUI for performing different database operations (For ex. Insert, delete, update) and retrieving data through RMI.


1
Expert's answer
2021-08-31T00:53:10-0400
import java.rmi.*;  
import java.rmi.server.*;  
import java.sql.*;  
import java.util.*;  
class StudentAccountImp extends UnicastRemoteObject implements Bank{  
StudentAccountImp()throws RemoteException{}  
  
public List<StudentAccount> getCustomers(){  
List<StudentAccount> list=new ArrayList<StudentAccount>();  
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()){  
StudentAccount c=new StudentAccount();  
c.setAcc_no(rs.getInt(1));  
c.setFirstname(rs.getString(2));  
c.setLastname(rs.getString(3));  
c.setEmail(rs.getString(4));  
c.setFee(rs.getFloat(5));  
list.add(c);  
}  
  
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