SMA and LLA Guide : solidDB® Server Control API (SSC API) : SSC API reference : SSCStartServer
  
SSCStartServer
The SSCStartServer functions starts the linked library access server.
In multithreaded environments, the server runs in a separate threads from the client. For the duration of the application, the application can start or stop the server subroutines as needed.
SscRetT SSC_CALL SSCStartServer(int argc, char* argv[], SscServerT* h SscStateT runflags)
Parameters
Parameters
Usage type
Description
argc
in
Number of command-line arguments.
argv
in, use
Array of command-line arguments.
For a list of available arguments, see “solidDB® command-line options” in the solidDB® Administrator Guide.
h
out
Returns a handle to the started server. This handle is needed when referencing the server with other Control API functions.If the server is started successfully, the SSCStartServer routine sets this parameter to point to the handle for this server.
runflags
in
The value for this parameter is a combination of 2 flags: the open flag and the netcopy disabling flag. The following flag symbols can be used:
SSC_STATE_OPEN – the open flag is set to 1: new connections are allowed.
SSC_STATE_CLOSED – the open flag is set to 0: all new network and LLA connections are rejected, except for connections from solidDB® Remote Control (solcon) program.
SSC_DISABLE_NETCOPY – the netcopy disabling flag is set to 1: in HotStandby configuration, no netcopy can be received by the server for which the SSC_DISABLE_NETCOPY is set.
The flag does not prevent the server to act as a source of netcopy. If only SSC_DISABLE_NETCOPY flag is set, the server is in the closed state. To enable netcopy, use the SSC API function SSCSetState() with the runflag value SSC_STATE_OPEN or SSC_STATE_CLOSED.
runflags = SSC_STATE_OPEN | SSC_STATE_CLOSED | SSC_DISABLE_NETCOPY
Tip: The flags can be used in combinations, for example:
...
rc = SSCStartServer(g_argc, g_argv, &hh, SSC_STATE_OPEN|SSC_DISABLE_NETCOPY);
...
If the server is started as closed, it can be opened with ADMIN COMMAND 'open', or with the solcon command open. The same effect can be achieved with the SSC API function SSCSetState().
Return value
SSC_SUCCESS - The server started.
SSC_ERROR - The server failed to start.
SSC_ABORT
SSC_BROKENNETCOPY - Database corrupted because of incomplete netcopy.
SSC_FINISHED
SSC_CONT
SSC_CONNECTIONS_EXIST
SSC_UNFINISHED_TASKS
SSC_INVALID_HANDLE - Invalid local server handle given.
SSC_INVALID_LICENSE - No license or invalid license file found.
SSC_NODATABASEFILE - No database file found.
SSC_SERVER_NOTRUNNING
SSC_INFO_SERVER_RUNNING - The server is already running.
SSC_SERVER_INNETCOPYMODE - The server is in netcopy mode (HotStandby only).
SSC_DBOPENFAIL - Failed to open database.
SSC_DBCONNFAIL - Failed to connect to database.
SSC_DBTESTFAIL - Database test failed.
SSC_DBFIXFAIL - Database fix failed.
SSC_MUSTCONVERT - Database must be converted.
SSC_DBEXIST - Database exists.
SSC_DBNOTCREATED - Database not created.
SSC_DBCREATEFAIL - Database create failed.
SSC_COMINITFAIL - Communication init failed.
SSC_COMLISTENFAIL - Communication listen failed.
SSC_SERVICEFAIL - Service operation failed.
SSC_ILLARGUMENT - Illegal command line argument.
SSC_CHDIRFAIL - Failed to change directory.
SSC_INFILEOPENFAIL - Input file open failed.
SSC_OUTFILEOPENFAIL - Output file open failed.
SSC_SRVCONNFAIL - Server connect failed.
SSC_INITERROR - Operation init failed.
SSC_CORRUPTED_DBFILE - Assert or other fatal error.
SSC_CORRUPTED_LOGFILE - Assert or other fatal error.
Comments
By default, the state is set to SSC_STATE_OPEN.
This function has no corresponding solidDB® SQL extension ADMIN COMMAND.
When you start a new solidDB® server, you must explicitly specify that the solidDB® server creates a database with the function SSCStartServer() by using the -U username -P password -C catalogname (the default database catalog name) parameters. For details, read Explicit startup with SSC API function SSCStartServer.
If you are restarting a database server (a database exists in the directory), the server uses the existing database.
The SSCStartServer function can spawn multiple threads to run the server tasks. The server tasks include processing local and remote client requests, as well as running various background tasks, such as checkpoints, merges, and so on.
Note To start a diskless server, see SSCStartDisklessServer.
Example: Starting up SSCStartServer
Start SSCStartServer with the server name, the catalog name, and the administrator username and password:
SscStateT runflags = SSC_STATE_OPEN;
SscServerT h;
char* argv[5];
argv[0] = "appname"; /* path and filename of the user app. */
argv[1] = "-nsolid1";
argv[2] = "-Udba";
argv[3] = "-Pdba";
argv[4] = "-Cdba";
/* Start the server */
rc = SSCStartServer(argc, argv, &h, run_flags);
If you already have an existing database, you do not need to specify the username and password, or the catalog name.
Related reference
SSCStopServer
See also
SSC API reference