Como obtner Informacion del ADS Instalado SOLUCIONADO

Como obtner Informacion del ADS Instalado SOLUCIONADO

Postby VitalJavier » Wed Mar 02, 2016 5:35 pm

Que tal a todos, buen día
Pues con la duda que dice el "Asunto",
Quisiera obtener los datos del ADS ya instalado
como, numero de usuarios conectados, numero de
conexiones, numero máximo de areas de trabajo
etc., etc.

Alguien ya tubo la inquietud de esto ???

Saludos.
Last edited by VitalJavier on Fri Mar 04, 2016 3:31 pm, edited 1 time in total.
User avatar
VitalJavier
 
Posts: 241
Joined: Mon Jun 10, 2013 6:40 pm

Re: Como obtner Informacion del ADS Instalado

Postby vilian » Wed Mar 02, 2016 7:18 pm

Olá,

Pode obner usando as funções AdsMg. Faço assim:

Code: Select all  Expand view

      IF AdsIsServerLoaded( Left(cDirAds,2), @nConn ) = ADS_REMOTE_SERVER
             AdsSetServerType(2)
             AdsMgConnect( Left(cDirAds,2),,,@nConn )
             aTemp := AdsMgGetInstallInfo()
             cAdsSerial := IF(Len(aTemp)>=8,aTemp[8],"")
             aTemp := NIL
       ENDIF    
 
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Como obtner Informacion del ADS Instalado

Postby Patricio Avalos Aguirre » Thu Mar 03, 2016 2:38 pm

Hola

revisa el ejemplo que trae ADS

testmg.prg

ahi esta todo..

Code: Select all  Expand view
/*
 * $Id: testmg.prg 9279 2011-02-14 18:06:32Z druzus $
 */


/*
 * Harbour Project source code:
 * Advantage Database Server RDD Management Functions Test program
 *
 * Copyright 2001 Brian Hays <bhays@abacuslaw.com>
 * www - http://www.harbour-project.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
 *
 * As a special exception, the Harbour Project gives permission for
 * additional uses of the text contained in its release of Harbour.
 *
 * The exception is that, if you link the Harbour libraries with other
 * files to produce an executable, this does not by itself cause the
 * resulting executable to be covered by the GNU General Public License.
 * Your use of that executable is in no way restricted on account of
 * linking the Harbour library code into it.
 *
 * This exception does not however invalidate any other reasons why
 * the executable file might be covered by the GNU General Public License.
 *
 * This exception applies only to the code released by the Harbour
 * Project under the name Harbour.  If you copy code from other
 * Harbour Project or Free Software Foundation releases into a copy of
 * Harbour, as the General Public License permits, the exception does
 * not apply to the code that you add in this way.  To avoid misleading
 * anyone as to the status of such modified files, you must delete
 * this exception notice from them.
 *
 * If you write modifications of your own for Harbour, it is your choice
 * whether to permit this exception to apply to your modifications.
 * If you do not wish that, delete this exception notice.
 *
 */



#include "ord.ch"
#include "set.ch"
#include "Ads.ch"

function Main()

   local i

   REQUEST _ADS
   rddRegister( "ADS", 1 )
   rddsetdefault( "ADS" )
   SET SERVER LOCAL    // REMOTE

   AdsSetFileType(ADS_CDX)

   // use test   // make this available to get some stats on open tables below

   ? "Advantage Database Server Management Functions in Harbour"
   ?
   ? "Connect:", AdsMgConnect( 'C:' )

   aRay := AdsMgGetInstallInfo()
   IF len(aRay) > 7
      ? "Install info:"
      ? aRay[1]
      ? aRay[2]
      ? aRay[3]
      ? aRay[4]
      ? aRay[5]
      ? aRay[6]
      ? aRay[7]
      ? aRay[8]
      ?
   ENDIF

      ? "Activity info:"
   ? AdsMgGetActivityInfo(1)
   ? AdsMgGetActivityInfo(2)

   aRay := AdsMgGetActivityInfo(3)
   IF len(aRay) > 3
      ? "Up Time:", aRay[1], aRay[2], aRay[3], aRay[4]
      ?
   ENDIF

   ?    "    Item          In Use     MaxUsed    Rejected"
   aRay := AdsMgGetActivityInfo(4)
   IF len(aRay) > 2
      ? "Users:         ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(5)
   IF len(aRay) > 2
      ? "Connections:   ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(6)
   IF len(aRay) > 2
      ? "WorkAreas:     ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(7)
   IF len(aRay) > 2
      ? "Tables:        ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(8)
   IF len(aRay) > 2
      ? "Indexes:       ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(9)
   IF len(aRay) > 2
      ? "Locks:         ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(10)
   IF len(aRay) > 2
      ? "TpsHeaderElems:", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(11)
   IF len(aRay) > 2
      ? "TpsVisElems:   ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(12)
   IF len(aRay) > 2
      ? "TpsMemoElems:  ", aRay[1], aRay[2], aRay[3]
   ENDIF

   aRay := AdsMgGetActivityInfo(13)
   IF len(aRay) > 2
      ? "WorkerThreads: ", aRay[1], aRay[2], aRay[3]
   ENDIF

   wait
   ?

   aRay := AdsMgGetCommStats()
   IF len(aRay) > 10
      ? aRay[1] , "% of pkts with checksum failures "
      ? aRay[2] , "Total packets received           "
      ? aRay[3] , "Receive packets out of sequence  "
      ? aRay[4] , "Packet owner not logged in       "
      ? aRay[5] , "Receive requests out of sequence "
      ? aRay[6] , "Checksum failures                "
      ? aRay[7] , "Server initiated disconnects     "
      ? aRay[8] , "Removed partial connections      "
      ? aRay[9] , "Rcvd invalid packets (NT only)   "
      ? aRay[10], "RecvFrom failed (NT only)        "
      ? aRay[11], "SendTo failed (NT only)          "
   ENDIF

   wait
   ?

   aRay := AdsMgGetConfigInfo(0)
   IF len(aRay) > 24
      ? aRay[1] , " number connections            "
      ? aRay[2] , " number work areas             "
      ? aRay[3] , " number tables                 "
      ? aRay[4] , " number indexes                "
      ? aRay[5] , " number locks                  "
      ? aRay[6] , " user buffer                   "
      ? aRay[7] , " statistics dump interval      "
      ? aRay[8] , " max size of error log         "
      ? aRay[9] , " number TPS header elems       "
      ? aRay[10], " number TPS vis elems          "
      ? aRay[11], " number TPS memo elems         "
      ? aRay[12], " number rcv ECBs (NLM only)    "
      ? aRay[13], " number send ECBs (NLM only)   "
      ? aRay[14], " number packets per burst      "
      ? aRay[15], " number worker threads         "
      ? aRay[16], " index sort buffer size        "
      ? aRay[17], " reserved                      "
      ? aRay[18], " reserved                      "
      ? aRay[19], " error log path              "
      ? aRay[20], " semaphore file path         "
      ? aRay[21], " TPS log file path           "
      ? aRay[22], " reserved                      "
      ? aRay[23], " reserved                      "
      ? aRay[24], " NT Service IP send port #     "
      ? aRay[25], " NT Service IP rcv port #      "
      // ? aRay[26], " reserved                      "
   ENDIF

   wait
   ?

   aRay := AdsMgGetConfigInfo(1)
   IF len(aRay) > 12
      ? aRay[1] , " Total mem taken by cfg params "
      ? aRay[2] , " memory taken by connections   "
      ? aRay[3] , " memory taken by work areas    "
      ? aRay[4] , " memory taken by tables        "
      ? aRay[5] , " memory taken by indexes       "
      ? aRay[6] , " memory taken by locks         "
      ? aRay[7] , " memory taken by user buffer   "
      ? aRay[8] , " memory taken by TPS hdr elems "
      ? aRay[9] , " memory taken by TPS vis elems "
      ? aRay[10], " mem taken by TPS memo elems   "
      ? aRay[11], " mem taken by rcv ECBs (NLM)   "
      ? aRay[12], " mem taken by send ECBs (NLM)  "
      ? aRay[13], " mem taken by worker threads   "
   ENDIF

   ?

   // First arg:  pass in a file name for list of those with that file open
   // Second arg: Max # of users (required for memory allocation, default is 100)
   aRay := AdsMgGetUserNames()
   ? "Number of connected users: ", len(aRay)
   FOR i := 1 TO len(aRay)
      ? aRay[i]
   NEXT


   ?
   ? "Disconnect", AdsMgDisconnect()
   ?

   ? "end"
   ?
return nil
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: Como obtner Informacion del ADS Instalado SOLUCIONADO

Postby VitalJavier » Thu Mar 03, 2016 4:25 pm

Gracias por su ayuda

Lo Resolví así por si a alguien le interesa

Code: Select all  Expand view

        Select 0
        ADSCreateSQLStatement("misusers",3)
        cSQL :="EXECUTE PROCEDURE sp_mgGetConnectedUsers()"
        ADSExecuteSQLDirect(cSQL)
        SELECT misusers
        nNumUsers := LastRec()   //Aquí cuento los números de usuarios conectados
        DbCloseArea()

 


y ya con ese resultado puedo hacer lo que necesito.
Saludos.
User avatar
VitalJavier
 
Posts: 241
Joined: Mon Jun 10, 2013 6:40 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Horizon and 92 guests