Detect Jaguar status (this howto is deprecated)Tag(s): DEPRECATED
About cookies on this site
We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
import java.util.*;
import com.sybase.jaguar.system.*;
import SessionManager.*;
import org.omg.CORBA.*;
public class JaguarStatus {
public static void main(String args[]) {
// execute with
// java JaguarStatus localhost 9000 jagadmin ""
// [machine] [port] [user] [pwd]
// check the ERRORLEVEL for the result
// 0 Ok (report Admin/Ready mode)
// 1 net error
// 2 other error
java.util.Properties props = new java.util.Properties();
props.put("org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB");
// no retry please.
props.put("com.sybase.CORBA.RetryCount", "0");
ORB orb = ORB.init(args, props);
int rc = 0;
try {
Manager manager =
ManagerHelper.narrow(orb.string_to_object
("iiop://" + args[0] + ":" + args[1]));
Session session = manager.createSession(args[2], args[3]);
Management manage =
ManagementHelper.narrow(session.create("Jaguar/Management"));
System.out.println
("Server Name = " + manage.getServer()
+ " (v" + manage.getServerVersion() + ")\nServer Status is "
+ manage.getStatus());
}
catch (COMM_FAILURE e) {
System.out.println
("The server at " + args[0] + " can't be reached!\n" +
e.getMessage());
rc = 1;
}
catch (Exception ex) {
System.out.println("Exception caught! \n" + ex.getMessage());
rc = 2;
}
finally {
System.exit(rc);
}
}
}