Programmer Guide : solidDB® SA : Getting started with solidDB® SA
  
Getting started with solidDB® SA
The solidDB® SA can be used with shared memory access (SMA) and linked library access (LLA). This topic describes the steps that you should take before using solidDB® SA.
Before getting started with solidDB® SA, be sure you have:
1 If you are building a local application, you need the SMA or LLA library file. The SMA and LLA library files are installed during solidDB® installation. The libraries include the solidDB® SA functions as well as full server functionality.
2 If you are building a remote user application, you need the solidDB® SA library so that you can link it into your application, for example solidimpsa.lib for Windows operating systems.
3 Started solidDB®. If necessary, create a new database before using solidDB® SA.
Setting up the development environment and building a sample program
Building an application program using the solidDB® SA library in the linked library access or the SA client library is identical to building any normal C/C++ program:
1 Insert the linked library access library file or SA client library into your project. See “Creating and running LLA applications” in the solidDB® Shared Memory Access and Linked Library Access User Guide for the correct filenames.
2 Include the following solidDB® SA header file, which is required in applications using solidDB® SA library in the linked library access or the solidDB® SA client library:
#include "sa.h"
3 Insert the directory containing all the other necessary solidDB® SA headers into your development environment’s include directories setting.
4 Compile the source code.
5 Link the program.
Verifying the development environment setup
You can verify the development setup with the solidDB® SA sample program. This enables you to verify your development environment without writing any code.
Verify the following in your development environment:
In the Windows environment, the TCP/IP services are provided by standard DLL wsock32.dll. To link these services into your project, add wsock32.lib into linker’s lib file list.
Connecting to a database by using the sample application
In solidDB® SA, a connection to a database is represented by the SaConnectT structure. This structure is established by calling the function SaConnect. The following sample code establishes a connection to a database listening TCP/IP protocol at local machine port 1313. User account DBA with password DBA has been defined in the database.
SaConnectT* scon;
scon = SaConnect("tcp localhost 1313", "dba", "dba");
if (scon == NULL)
  {
  /* Connect failed, display connect error text. */
  char* errstr;
  SaErrorInfo(NULL, &errstr, NULL); printf("%s\n", errstr);   return(1);
}
See also
solidDB® SA