Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

rmi and resultset

 
ariel javier
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi,
please help
here is my code:

import java.rmi.*;
import java.sql.*;
public interface DispInt extends Remote
{
public String message()throws RemoteException;

public String greet(String msg) throws RemoteException;

public void addRecord()throws RemoteException;

public ResultSet showRecord()throws RemoteException, SQLException;

}
----------------
import java.rmi.*;
import java.rmi.server.*;
import java.sql.*;
public class Display extends UnicastRemoteObject implements DispInt
{
Connection con;
Statement s;
ConnectDb c;
ResultSet rs;
static String hostname="192.168.0.52";
public Display()throws RemoteException, SQLException
{
super();
c=new ConnectDb();
con=c.db("emp");
s=con.createStatement();

}

public ResultSet showRecord()throws RemoteException, SQLException
{
rs=s.executeQuery("SELECT EmployeeName from EmployeeINfo");
return rs;
}

public void addRecord()
{
try
{

s.executeUpdate("INSERT INTO EmployeeInfo VALUES('7','Alexadra','Olongapo')");

}
catch(Exception e)
{
System.out.print(e);
}



}
public String greet(String msg)
{
return "welcome "+msg;
}
public String message()
{
System.out.println("alert!!");
return "welcome";

}

public static void main(String a[])
{

try
{
Display disp=new Display();

Naming.rebind("//"+hostname+"/DispInt",disp);
System.out.println("registerd");
}
catch(Exception e)
{
System.out.println(e);
}


}
}
--
import java.rmi.*;
import java.sql.*;
public class DispClient
{
static String hostname="192.168.0.52";
static ResultSet rs;
public static void main(String a[])
{
try
{
DispInt myobj=(DispInt)Naming.lookup("//"+hostname+"/DispInt");
System.out.println(myobj.greet("jessica"));
System.out.println(myobj.message());

rs=myobj.showRecord();
while(rs.next())
{

System.out.println(rs.getString("EmployeeName"));
}

}
catch(Exception e)
{
System.out.println(e);
}
}
}
when i run my client program it shows java.rmi.UnmarshalExeption, why?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
This should have gone with the question that you asked.

Closing this thread.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!