Examples for using the Adaptive Server client

Two stored procedures, sp_addserver and sp_addexternlogin, add the TDS remote server connection to Adaptive Server.You can execute these stored procedures using any client that can connect to the Adaptive Server database and execute SQL commands. This example uses the Adaptive Server command line utility isql.

C:\Sybase> isql -U sa -P Sybase4me -S myserver
               sp_addserver MYHOST_UAF
               go
               -----------
               sp_addexternlogin MYHOST_UAF, SA, SA@MYSERVER,      sYBASE4ME
               go
               ------------

The remote server representing the UAF TDS service is complete, and you can now call other stored procedures. This example shows a stored procedure that lists the available services in the agent:

C:\Sybase> isql -U sa -P Sybase4me -S myserver
               MYHOST_UAF...uaf_list_services
               go
               -----------
      Name                  Version   ServiceDescription
-----------      ­­­     -------   ------------------
   FileTransferService       1.0.0    Transfers files between client and agent.

   SelfDiscoveryService      1.0.0    Registers the agent and its                                       services and plug-ins with discovery                                       servers.
      MYHOST_UAF...sp_uaf_serviceinvoke "SelfDiscoveryService",discoverAgents
      go
      ------------------
         Host                   Port          Version         
                     -----------            ---------      ­­----------
         MYHOST                 9999           1.5.0
         MYOTHERHOST            14578          1.5.0
         -----------            ---------      ----------
         (2 rows returned)

The calling interface to plug-ins requires information, such as version and instance number.

For example, this next example shows a plug-in called “com.sybase.ase” in version 15.0, the first plug-in instance of that name. To display the last 20 lines of the log and return to the calling procedure, enter:

C:\Sybase> isql -U sa -P Sybase4me -S myserver
                    MYHOST_UAF...uaf_invoke_plugin_operation 
                       "com.sybase.ase", "15.0.0",1, getASELogTail,20
                    go
                    --------------
                    ASE Log
                    --------------
                    00:00000:00001:2005/10/13 16:31:31:26 server  Master                     device size: 30 megabytes, or 15360 virtual pages.(A                     virtual page is 2048 bytes.)
                    .
                    .
                    .
                    00:00000:00010:2005/10/14 16:36:34:30 server  Maximum                     number of user seat licenses used since startup: 1
                    --------------
                    (20 rows returned)