Welcome, guest | Sign In | My Account | Store | Cart

Stop the Cloudscape Network Server.

Tcl, 109 lines
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
@echo off

setlocal

echo ###################################################
echo # Start Cloudscape Server on %computername%
echo ###################################################

set derbyDir=D:\CloudscapeDatabases
set traceDir=D:\CloudscapeDatabases\trace

set CLASSPATH=%CLASSPATH%;d:\IBM\Cloudscape_10.1\lib\derby.jar
set CLASSPATH=%CLASSPATH%;d:\IBM\Cloudscape_10.1\lib\derbyclient.jar
set CLASSPATH=%CLASSPATH%;d:\IBM\Cloudscape_10.1\lib\derbynet.jar
set CLASSPATH=%CLASSPATH%;d:\IBM\Cloudscape_10.1\lib\derbytools.jar

D:\scripts\TCL\JACL\cloudscape\startNetworkServer.tcl %derbyDir% %traceDir%

endlocal

======================================================================
# 
# stop cloudscape network server 

####################################################################
# Patrick Finnegan 17/11/2005.  V1. 
####################################################################

####################################################################
# Get Cloudscape connection.
####################################################################
proc stopServer { } {

   puts "\n**********"
   puts "Stop Server"
   puts "**********\n"

   global null

   # import required classes 

   java::import java.net.InetAddress
   java::import org.apache.derby.drda.NetworkServerControl

   puts "\nimported classes are:\n"
   
   foreach i [java::import] {
       
      puts [ format "%-5s %-50s" " " $i ] 

   }

   if { [ catch { java::new NetworkServerControl } r ] == 0 } {
   
        set NetworkServerControl $r 

   } else {

        puts $r 
        return -code error

   }

   puts "\nNetworkServerControl shutdown\n" 

   if { [ catch { $NetworkServerControl shutdown } r ] == 0 } {
   
        puts $r 

   } else {

        puts $r 
        return -code error

   }
}
####################################################################
# Main Control.
####################################################################

set computername [ lindex [ array get env COMPUTERNAME ] 1 ]

lappend optList "-Dderby.drda.host=$computername"
lappend optList "-Dderby.drda.portNumber=1527"

puts "\n java command line options list is:\n"

foreach x $optList {
    puts [ format "%-5s %-50s" " " $x ] 
}

set tclblend_init $optList  

#call java package 

package require java

set null [ java::null ]

if { [ catch { stopServer } r ] == 0 } {

    puts "\n Cloudscape Network Server on $computername shutdown successfully\n" 

} else {

    puts $r 
    exit 1   

}

This script uses the Cloudscape Java API to stop the Cloudscape network server.

Requires Tclblend.

Tclblend: http://tcljava.sourceforge.net/docs/website/index.html. Tclblend Wwindows Build Instructions: http://wiki.tcl.tk/9993

Created by Patrick Finnegan on Wed, 7 Dec 2005 (MIT)
Tcl recipes (162)
Patrick Finnegan's recipes (56)

Required Modules

  • (none specified)

Other Information and Tasks