In build files, use the jag_connect command to connect to a server or to specify the server name for local mode. You cannot use jag_connect from the command line; instead use the connection or local-mode arguments described in “Local versus connected mode”.
jag_connect must be executed before any other jagtool commands in the build file. jag_connect can be included directly in any target, or in a “connect” target that other targets list as a dependency.
As with jagtool, you can run jagant in local or connected mode. “Local versus connected mode” explains the difference.
To run jagant in connected mode, specify these options for the jag_connect command:
user The user name used to connect. The default is jagadmin.
password The password used to connect. The default is no password.
logfile The log file for the connection attempt. The default is System.out.
To run in local mode, specify these options for the jag_connect command:
serverName Specifies the name of the server to use when running in local mode. Specify the name of the server that you would connect to if running in connected mode. If you specify this option, the connected-mode arguments are ignored and jagant runs in local mode.
You can use multiple jag_connect commands in a single build file, which allows you to execute jagtool commands for different servers. Each time jag_connect is executed, the current connection or local-mode session is closed and a new one is opened. For example, this code restarts two servers:
<target name="restart_all_servers"> <jag_connect host="host1" password-="jagpass" /> <jag_restart /> <jag_connect host="host2" password="jagpass" /> <jag_restart /></target>
A connection to host1 is opened and the server on host1 is restarted. Then the connection is closed, a connection is opened to host2, and the server on host2 is restarted. The port number for both servers is 9000 and the user name is jagadmin (the defaults). The password for both servers is jagpass, and the log file is System.out.
Copyright © 2003. Sybase Inc. All rights reserved. |
![]() |