SAS 9.1.3 Integration Technologies » Developer's Guide


Developing Windows Clients
Client Requirements
Client Installation
Security
Selecting a Windows Programming Language
Programming with Visual Basic
Programming in the .NET Environment
Using VBScript
Programming with Visual C++
Using the Object Manager
Creating an Object
Object Manager Interfaces
Using a Metadata Server with the Object Manager
Metadata Configuration Files
Error Reporting
Code Samples
Using Connection Pooling
Choosing Integration Technologies or COM+ Pooling
Using Integration Technologies Pooling
Using Com+ Pooling
Pooling Samples
Using the IOM Data Provider
Using the Workspace Manager
Class Documentation
Windows Clients

Pooling Samples

Using COM+ Pooling

The following code sample shows how to create and use a Workspace object using a COM+ pooling configuration:
   ' Create the pooled object
   Dim obPooledObject As New SASObjectManager.PooledObject
   Dim obSAS As SAS.Workspace
   Set obSAS = obPooledObject.SASObject

   ' Test the object
   Debug.Print obSAS.Utilities.HostSystem.DNSName

   ' Return the object to the pool
   set obSAS=Nothing
   obPooledObject.ReturnToPool

Using SAS Integration Technologies Pooling

The following code sample shows how to create and use a Workspace object using a SAS Integration Technologies pooling configuration:
   Set obServer  = CreateObject("SASObjectManager.ServerDef")
   Set obLogin = CreateObject("SASObjectManager.LoginDef")
   Set obObjectFactory = CreateObject("SASObjectManager.ObjectFactory")

   ' Define a ServerDef and LoginDef for the pool
   obServer.MachineDNSName = "localhost"
   ' For VBScript, set obServer.Protocol to 2 instead of ProtocolBridge
   obServer.Protocol = ProtocolBridge
   obServer.Port = 8591
   obServer.ShutdownAfter = 1
   obServer.RunForever = False
   obServer.RecycleActivationLimit = 10000
   obLogin.LoginName = "mydomain\myuserid"
   obLogin.Password = "myPassword"

   ' Create the pool 
   Set obPool = obObjectFactory.ObjectPools.CreatePoolByServer(
      "myPool", obServer, obLogin)

   ' Create a pooled object 
   Set obPooledWorkspace = obPool.GetPooledObject("", "", 10000)
   Set obSAS = obPooledWorkspace.SASObject

   ' Test the object 
   Debug.Print obSAS.Utilities.HostSystem.DNSName

   ' Return the object to the pool
   Set obSAS = Nothing
   obPooledWorkspace.ReturnToPool
   Set obPooledWorkspace = Nothing