solidDB Help : Programming : solidDB SA : Getting started with solidDB SA
  
Getting started with solidDB SA
solidDB SA can be used with Shared Memory Access (SMA) and Linked Library Access (LLA).
Before getting started with solidDB SA, complete the following tasks:
1 If you are building a local application, make sure that you have 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, make sure that you have the solidDB SA library so that you can link it into your application, for example solidimpsa.lib for Windows operating systems.
3 Start 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 by using the solidDB SA library in the LLA or SA client library is identical to building any normal C/C++ program:
1 Insert the LLA library file or SA client library into your project. See Linking the application to the LLA library for the correct filenames.
2 Include the following solidDB SA header file:
#include "sa.h"
3 Insert the directory that contains all the other necessary solidDB SA headers into the include directories setting for your development environment.
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 the linker 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 that listens on the TCP/IP protocol at port 1313, where the user account DBA (with password DBA) is 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);
}
Go up to
solidDB SA