rmi help needed
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   poppy_123_poppy_123
Posted On:   Friday, December 19, 2003 04:47 PM

hello guys, how i can access the variables of static main function from other function e.g public static void main(String []a)throws RemoteException { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String s = "jdbc:odbc:addressbook"; Connection con = DriverManager.getConnection (s, "", ""); Registry reg=LocateRegistry.createRegistry(1099)' Server server=new Server(); reg.rebind("rmi://127.0.0.2/server",server); } now how i can access con object in this function. void display() { Statement stmt=con.createStatement();    More>>
			hello guys,
			
how i can access the variables of static main function from other function e.g

public static void main(String []a)throws RemoteException

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String s = "jdbc:odbc:addressbook";

Connection con = DriverManager.getConnection (s, "", "");

Registry reg=LocateRegistry.createRegistry(1099)'

Server server=new Server();

reg.rebind("rmi://127.0.0.2/server",server);

}



now how i can access con object in this function.


void display()

{

Statement stmt=con.createStatement();

}


thanks,
   <<Less

Re: rmi help needed

Posted By:   poppy_123_poppy_123  
Posted On:   Monday, December 22, 2003 09:18 PM

Hello guys,

I need help here.

Hello dear

I want to pass the string to client's
method "displayRecord".

How i can pass it

there is interface of client, with the name "IClient" .

interface can't not be initiated, so how i will do.




[code:]



public void showRecord()throws RemoteException //server
class method

{

try

{

String s="",display=""; //string variables

rs=stmt.executeQuery("select * from address_book");

while(rs.next())

{

String s1=rs.getString(1);

int i1=rs.getInt(2);

String s2=rs.getString(3);

String s3=rs.getString(4);

String s4=rs.getString(5);

String s5=rs.getString(6);

int i2=rs.getInt(7);

String s6=rs.getString(8);

String s7=rs.getString(9);

String s8=rs.getString(10);

s+=s1+" "+s2+" "+i1+" "+s3+" "+s4+" "+s5+" "+s6+" "+i
2+" "+s7+" "+s8); //records stored in string

display+=s+"
"; //display string

calll it //displayRecord(display); //client method

}catch(Exception e)

{

e.printStackTrace();

}

}



[/code:]
About | Sitemap | Contact