Alchemy Server SDK
Alchemy Server SDK
Version 8.3
Reference Guide
Captaris, Inc., 301 116th Ave SE, Suite 400 Bellevue, Washington 98004-6446
Phone +1 425.455.6000, www.captaris.com
Alchemy is a registered trademark of Captaris, Inc. All rights reserved. All other trademarks or registered trademarks are the property of their
respective companies. Other products and company names mentioned herein may be the trademarks of their respective owners.
1
Contents
2
ALCHEMY SERVER SDK TOOLKIT
1.1 INTRODUCTION
The Alchemy Server SDK Toolkit is a set of COM (Component Object Model) specification
compliant tools that provide system administrator with a simple and efficient interface for monitoring
and managing Alchemy databases and users. Using the Alchemy Server SDK Toolkit, developers
can:
• Control/simplify/customize the Alchemy Server interface.
• Extend or limit Alchemy's current functionality or permissions.
• Integrate Alchemy into existing workflow or enterprise systems.
• Automate Alchemy Server functions.
OVERVIEW
The Alchemy Server SDK allows you to write your own interface to get statistical data from the
server, control the databases and connection status as seen in the Alchemy Server MMC Snap In.
Additionally, the SDK can be installed and run remotely.
Whether you design a simple UI or chose to use a command line with the Server SDK, Alchemy
gives you the versatility of automate the Server for unattended operation. Users creating new
databases, adding data and building database through an automated process can use the SDK to add
the database to the server on the fly. Alchemy Server opens databases exclusively, and users who
back up their databases can disconnect all the users from the database and suspend the database
during the backup process. Then, once the backup is complete, users can reinstate/resume the
database on the server.
The Alchemy Server API interface is only dependent on one .dll file, the AuServerAPI.dll. This file
can be placed on a remote machine and used to access any Alchemy Server on the network.
INSTALLATION INSTRUCTIONS:
To install and register the AuServerAPI on a remote PC:
1. Locate the AuServerAPI.dll file on the server.
1-1
Alchemy Server SDK examples
This section provides three code examples. Each example focuses on a different portion of the COM
interface; the server, the database, and the connection methods and properties.
The following descriptions of the sample pieces of code are intended to give the developer a brief
introduction to some of the methods and properties described in the documentation. Only portions of
the code are described. Between the three samples, all the properties and methods of the Alchemy
Server Application object are used.
Because this is a very simple example, error handling was built into the code to support a user
stopping the Alchemy Server service via the Snap-In or the Services module.
Dim au As AuServer.Application
Dim StartTime As Long
Dim TotalConn As Long
Dim MaxConn As Long
Dim BytesRead As Double
Dim BytesWritten As Double
Dim ReqCount As Double
Dim TransCount As Double
1-2
Alchemy Server SDK examples
1 ALCHEMY SERVER
SDK TOOLKIT
Exit Sub
'Quits program
Unload Form1
End Sub
'Gets the current Server Stats. The next line is on one line
au.GetServerStats TotalConn, MaxConn, BytesRead, BytesWritten,
ReqCount, TransCount
TxtTotalConn = TotalConn
TxtMaxConn = MaxConn
TxtBytesRead = BytesRead
TxtBytesWritten = BytesWritten
TxtReqCount = ReqCount
TxtTransCount = TransCount
Exit Sub
'Handles any errors that occur when service is stopped.
ServerStatsError:
MsgBox "ServerStatsError: Error number " & Err.Number & _
" occured. "& Err.Description & ". Please make sure " & _
"the Alchemy Server Service is still running."
End Sub
1-3
Alchemy Server SDK examples
To keep this sample code simple, error handling was left out. Users should add error code to handle a
user via the Snap-In or Services module stopping the Alchemy Server service. When the service is
stopped, the socket connection made by the API is lost.
Dim au As AuServer.Application
'For simplicity, removed the code which sets the columns for
'the grid used in the example.
End With
'If any users are connected to the server then get the connection
' data.
If au.ConnectionCount > 0 Then
'Gets the list(safe array) of connected users.
vConnList = au.ConnectionList
1-4
Alchemy Server SDK examples
1 ALCHEMY SERVER
SDK TOOLKIT
'populate the grid.
'The next two lines are one.
sConnDetails = vConnList(i) & vbTab &
au.ConnectionName(vConnList(i)) & vbTab
End Sub
To keep this sample code simple, error handling was left out. Users should add error code to handle a
user via the Snap-In or Services module stopping the Alchemy Server service. When the service is
stopped, the socket connection made by the API is lost.
'Parameter to create the object to access the server.
1-5
Alchemy Server SDK examples
Dim au As AuServer.Application
'Paramters associated with the DatabaseList property
Dim lDBList As Variant
Dim i As Long
Dim sDbList As String
Dim lDBID As Long
'Parameters for the GetDatabaseStatus method
Dim DBEnabled As Boolean
Dim DBLockConnID As Long
Dim DBLockTime As Long
'Parameters for the GetDatabaseTimes method.
Dim DBOpenTime As Long
'Parameters for the GetDatabaseStats method.
Dim ConnstoDB As Long
Dim DBBytesRead As Double
Dim DBBytesWritten As Double
Dim DBReqCount As Double
Dim DBTRansCount As Double
End Sub
With GridDbList
'For simplicity, removed the code which sets the columns for
'the grid used in the example.
End With
1-6
Alchemy Server SDK examples
1 ALCHEMY SERVER
SDK TOOLKIT
sDbList = lDBList(i) & vbTab & au.DatabaseName(lDBList(i)) &
vbTab
End Sub
CONNECT EXAMPLE
Dim application As AuServer.Application
'or
'or
1-7
Application object
The Application object provides a way to access runtime data about the Alchemy server running as an
NT 4.0 SP4x or 2000 service.
REMARKS:
When the Alchemy Server is not running then the Application object will be unable to connect to the
server and return the expected data.
USAGE:
To declare and create an Application object in Visual Basic:
1. ' Declare and create an Application object
2. Dim Application as AuServer.Application
3. Set Application = New AuServer.Application
PROPERTIES:
ServerNamePortNumberConnectionCountConnectionList
ConnectionNameCanConnectDatabaseCountDatabaseList
DatabaseName
METHODS:
GetServerTimesGetServerStatsDisconnect
DisconnectAllDisableNewConnectionsEnableNewConnections
GetConnectionTimesGetConnectionStatsGetDatabaseStatus
AddDatabaseRemoveDatabaseDisableDatabase
EnableDatabaseUnlockDatabaseDisableAllDatabases
EnableAllDatabasesGetDatabaseTimesGetDatabaseStats
Connect
1-8
ServerName property
1 ALCHEMY SERVER
SDK TOOLKIT
PROPERTY
Properties describe an object's characteristic attribute(s), such a size, position, or visibility. For
example, the Visible property determines whether the object can be seen when it is run. A property
can also control the behavior of other methods.
The value of the property can be retrieved (read-only) or set to a specific value (write-only) or a
combination of both (read-write). The type or range of the value is determined by the property. Most
properties are read-only.
If the property is read-only, you can retrieve the property's value but you cannot set or alter it to a
specific value. For example, the Application.CanShare property determines whether multiple users
can share the current application. The value of this property can be retrieved from the licensing
scheme but it cannot be altered. If the property is write-only, its value must first be set by the user. It
cannot be retrieved until after its value has been set. For example, the Application.Database.Password
property sets/changes the database password. This value must be set by the user in order to password
protect a database. It cannot be read from the API. If the property is read-write, its value can be
retrieved or modified. For instance, the Database.Title value can be returned or it can be changed by
the user.
METHOD
Methods represent an object's behavior, the things you can tell an object to do, such as save, close,
delete, exit, etc.
Unlike properties, the code for an object's method does not require an equal (=) sign.
A method may or may not have required and/or default arguments. If a method contains no
arguments, or if all the arguments are assigned default values, you just need to type the name of the
method to execute it.
A method may or may not have a return value. The return value is a request made by the method for a
specific data set. A request to display a specific date is an example of a return value. The return value
from a method can be assigned to a local variable or object. In Visual Basic, parentheses must be used
to enclose the arguments of methods that contain return values.
DESCRIPTION:
Returns a string representing the name of the computer where the server is running.
SYNTAX:
C++
Application::get_ServerName(BSTR* pName)
Visual Basic
Application.ServerName
1-9
PortNumber property
DATA TYPE:
String
DESCRIPTION:
Returns a long representing the port number that the server is listening to.
SYNTAX:
C++
Application::get_PortNumber(long* pPort)
Visual Basic
Application.PortNumber
DATA TYPE:
Long
DESCRIPTION:
Returns the number of current connections to the server.
SYNTAX:
C++
Application::get_ConnectionCount(long* pCount)
Visual Basic
Application.ConnectionCount
RETURN TYPE:
Long
DESCRIPTION:
Returns a safe array of connection IDs.
1-10
ConnectionName property
1 ALCHEMY SERVER
SDK TOOLKIT
SYNTAX:
C++
Application::get_ConnectionList(SAFEARRAY** ppList)
Visual Basic
Application.GetConnectionList
RETURN TYPE:
Safe Array
EXAMPLE:
“Connection example (ProConnBasics.vbp)” on page 1-4
DESCRIPTION:
Returns a string representing the IP address for the given connection.
SYNTAX:
C++
Application::get_ConnectionName(long nConnID,BSTR* pName)
Visual Basic
Application.ConnectionName (nConnID As Long)
PARAMETERS
Parameter Description
nConnID A long representing the ID of an active connection to the server.
DATA TYPE:
String
DESCRIPTION:
Returns a Boolean value that represents whether or not the server can accept new connections.
1-11
DatabaseCount property
SYNTAX:
C++
Application::CanConnect()
Visual Basic
Application.CanConnect
REMARKS:
When this property is set to True then new connections can be made to the server.
RETURN TYPE:
Boolean
DESCRIPTION:
Returns a long representing the number of databases currently defined in the server.
SYNTAX:
C++
Application::get_DatabaseCount(long* pCount)
Visual Basic
Application.DatabaseCount
DATA TYPE:
Long
DESCRIPTION:
Returns an array of Database IDs.
SYNTAX:
C++
Application::get_DatabaseList(SAFEARRAY** ppList)
Visual Basic
Application.DatabaseList
1-12
DatabaseName property
1 ALCHEMY SERVER
SDK TOOLKIT
RETURN TYPE:
Safe Array
EXAMPLE:
“Database example (ProDBBasics.vbp)” on page 1-5
DESCRIPTION:
Returns a string representing the path to the given database.
SYNTAX:
C++
Application::get_DatabaseName(long nDatabaseID,BSTR* pName)
Visual Basic
Application.DatabaseName (nDatabaseID as Long)
PARAMETERS
Parameter Description
nDatabaseID A long representing the ID of a database on the server.
DATA TYPE:
String
DESCRIPTION:
Retrieves the timing data for the server.
SYNTAX:
C++
Application::GetServerTimes(long* pStartTime)
Visual Basic
Application.GetServerTimes (pStartTime as Long)
1-13
GetServerStats method
PARAMETERS
Parameter Description
pStartTime A long representing the number of seconds the server has been running.
RETURN TYPE:
Long
EXAMPLE:
“Server statistics example (ProServerBasics.vbp)” on page 1-2
DESCRIPTION:
Retrieves the statistics about the Server.
SYNTAX:
C++
Application::GetServerStats(long* pTotalConnections,long*
pMaxConnections,double* pBytesRead,double* pBytesWritten,double*
pRequestCount,double* pTransactionCount)
Visual Basic
Application.GetDatabaseStats (pTotalConnections as Long,
pMaxConnections as Long, pBytesRead as Double, pBytesWritten as
Double, pRequestTime as Double, pTransactionCount as Double)
PARAMETERS
Parameter Description
pTotalConnections A long returned representing the total number of current connections to the
server.
pMaxConnections Along returned representing the maximum number of connections to the
server.
pBytesRead A double returned representing the number of bytes read by the connection.
pBytesWritten A double returned representing the number of bytes written by the
connection.
pRequestCount A double returned representing the number of requests received.
pTransactionCount A double returned representing the number of write transactions performed.
1-14
Disconnect method
1 ALCHEMY SERVER
SDK TOOLKIT
RETURN TYPE:
None
EXAMPLE:
“Server statistics example (ProServerBasics.vbp)” on page 1-2
DESCRIPTION:
Forcibly terminates a specific connection from the server.
SYNTAX:
C++
Application::Disconnect(long nConnID)
Visual Basic
Application.Disconnect(nConnID as Long)
PARAMETERS
Parameter Description
nConnID A long representing a connection that needs to be terminated.
RETURN TYPE:
None
DESCRIPTION:
Forcibly terminates all the connections to the server.
SYNTAX:
C++
Application::DisconnectAll()
Visual Basic
Application.DisconnectAll
1-15
DisableNewConnections method
RETURN TYPE:
None
DESCRIPTION:
Prevents the server from accepting new connections.
SYNTAX:
C++
Application::DisableNewConnections();
Visual Basic
Application.DisableNewConnections
RETURN TYPE:
None
DESCRIPTION:
Allows the server to accept new connections.
SYNTAX:
C++
Application::EnableNewConnections();
VISUAL BASIC
Application.EnableNewConnections
RETURN TYPE:
None
1-16
GetConnectionTimes method
1 ALCHEMY SERVER
1.20 GETCONNECTIONTIMES METHOD
SDK TOOLKIT
DESCRIPTION:
Retrieves the timing data for a given connection.
SYNTAX:
C++
Application::GetConnectionTimes(long nConnID,long* pLoginTime,long*
pIdleTime,long* pCpuTime)
Visual Basic
Application.GetConnectionTimes (nConnId as Long, pLoginTime as Long,
pIdleTime as Long, pCpuTime as Long)
PARAMETERS
Parameter Description
nConnID A long representing the connection.
pLoginTime Returns a long representing the time in seconds it took to establish a
connection to the database.
pIdleTime Returns a long representing the time in seconds that the connection has been
idle.
pCpuTime Returns a long representing the time in seconds that CPU was active during
the connection.
RETURN TYPE:
None
EXAMPLE:
“Connection example (ProConnBasics.vbp)” on page 1-4
DESCRIPTION:
Retrieves the statistics about a given IP connection.
SYNTAX:
C++
1-17
GetDatabaseStatus method
PARAMETERS
Parameter Description
nConnID A long representing the IP address that the return stats represents.
pDatabases A long representing the number of databases the connection is attached to.
pBytesRead A double returned representing the number of bytes read by the connection.
pBytesWritten A double returned representing the number of bytes written by the
connection.
pRequestCount A double returned representing the number of requests received.
pTransactionCount A double returned representing the number of write transactions performed.
RETURN TYPE:
None
EXAMPLE:
“Connection example (ProConnBasics.vbp)” on page 1-4
DESCRIPTION:
Returns the status of a specified database.
SYNTAX:
C++
Application::GetDatabaseStatus(long nDatabaseID,VARIANT_BOOL*
pEnabled,long* pLockConnID,long* pLockTime)
Visual Basic
Application.GetDatabaseStatus (nDatabaseID As Long, pEnabled As
Boolean, pLockConnID As Long, pLockTime As Long)
1-18
AddDatabase method
1 ALCHEMY SERVER
SDK TOOLKIT
PARAMETERS
Parameter Description
nDatabaseID A long representing a database available on the server.
pEnabled Returns a Boolean representing whether or not the database is enabled. A
True value is returned when the database is open.
pLockConnID Returns a long representing the connection that has locked the database, if
any.
pLockTime Returns a long representing the lock time in seconds.
RETURN TYPE:
None
EXAMPLE:
“Server statistics example (ProServerBasics.vbp)” on page 1-2
DESCRIPTION:
Dynamically opens a new database on the server.
SYNTAX:
C++
Application::AddDatabase(BSTR bstrPath)
Visual Basic
Application.AddDatabase(szPath as String)
PARAMETERS
Parameter Description
szPath A string value which represents the full path to the database.
RETURN TYPE:
None
EXAMPLE:
“Database example (ProDBBasics.vbp)” on page 1-5
1-19
RemoveDatabase method
DESCRIPTION:
Forcibly removes the new database from the server.
SYNTAX:
C++
Application::RemoveDatabase(long nDatabaseID)
Visual Basic
Application.RemoveDatabase(nDatabaseID as Long)
PARAMETERS
Parameters Description
nDatabaseID A long value which represents the Database ID.
RETURN TYPE:
None
EXAMPLE:
“Database example (ProDBBasics.vbp)” on page 1-5
DESCRIPTION:
Temporarily closes the all the files of a particular database on the server.
SYNTAX:
C++
Application::DisableDatabase(long nDatabaseID)
Visual Basic
Application.DisableDatabase(nDatabaseID as Long)
PARAMETERS
Parameter Description
nDatabaseID A long value which represents the database ID.
1-20
EnableDatabase method
1 ALCHEMY SERVER
SDK TOOLKIT
RETURN TYPE:
None
REMARKS:
The connections to the database will be suspended once the current read/write transaction is complete.
Connections made to the database are suspended not terminated. The server allows new connections
to the database but the users connection is in a suspended state.
DESCRIPTION:
Reopens a disabled database on the server.
SYNTAX:
C++
Application::EnableDatabase(long nDatabaseID)
Visual Basic
Application.EnableDatabase(nDatabaseID as Long)
PARAMETERS
Parameter Description
nDatabaseID A long value which represents the database ID.
RETURN TYPE:
None
REMARKS:
Suspended connections are resumed.
DESCRIPTION:
Forcibly removes a write lock from the database files on the server.
SYNTAX:
C++
1-21
DisableAllDatabases method
Application::UnlockDatabase(long nDatabaseID)
Visual Basic
Application.UnlockDatabase(nDatabaseID as Long)
PARAMETERS
Parameter Description
nDatabaseID A long value which represents the database ID.
RETURN TYPE:
None
DESCRIPTION:
Temporarily closes the all the database files on the server.
SYNTAX:
C++
Application::DisableAllDatabases ( )
Visual Basic
Application.DisableAllDatabases
RETURN TYPE:
None
REMARKS:
The connections to the database will be suspended once the current read/write transaction is complete.
Connections made to the database are suspended not terminated. The server allows new connections
to the database but the users connection is in a suspended state.
DESCRIPTION:
Reopens all the database files on the server.
1-22
GetDatabaseTimes method
1 ALCHEMY SERVER
SDK TOOLKIT
SYNTAX:
C++
Application.::EnableAllDatabases ( )
Visual Basic
Application.EnableAllDatabases
RETURN TYPE:
None
DESCRIPTION:
Retrieves the number of seconds a database has been open.
SYNTAX:
C++
Application::GetDatabaseTimes(long nDatabaseID,long* pOpenTime)
Visual Basic
Application.GetDatabaseTimes (nDatabaseID as Long, pOpenTime as Long)
PARAMETERS
Parameter Description
nDatabaseID A long representing the ID of a database on the server.
pOpenTime The long returned representing the number of seconds the database has been
opened.
RETURN TYPE:
None
DESCRIPTION:
Retrieves the statistics about a given Database.
SYNTAX:
C++
1-23
Connect method
PARAMETERS
Parameter Description
nDatabaseID A long representing the ID of a database that the return stats represents.
pConnections A long returned representing the number of the current connections to the
database.
pBytesRead A double returned representing the number of bytes read by all the
connections.
pBytesWritten A double returned representing the number of bytes written by all the
connections.
pRequestCount A double returned representing the number of requests received.
pTransactionCount A double returned representing the number of write transactions performed.
RETURN TYPE:
None
DESCRIPTION:
Connects to a specific Alchemy Server.
SYNTAX:
C++
Application::Connect(BSTR ServerName,long nPort)
Visual Basic
Application.Connect (ServerName as String, PortNumber as Long)
PARAMETERS
Parameter Description
ServerName A string representing the server name where the connection will be
established.
PortNumber A long representing the Service Port Number where service is listening.
1-24
Connect method
1 ALCHEMY SERVER
SDK TOOLKIT
RETURN TYPE:
None
REMARKS:
When connecting to the server local server, the parameters do not need to be set. When connecting
remotely the Server Name and Service Port Number specified are required. See the example below.
When the Alchemy Server service is stopped then an error message of 'permission denied' is thrown.
EXAMPLE:
“Connect example” on page 1-7
1-25
Connect method
1-26