In this tutorial I want give some details about database configuration.
tl;dr; See Step By Step SQL Server Express Setup document for multi user configuration.
SambaPOS can work in three database modes. Demo mode, single user mode and multi user mode.
You don’t need to install a database software just to evaluate SambaPOS. SambaPOS can work with a TXT file to let you understand basic SambaPOS functions. Some features might not work properly in demo mode so if you want to evaluate it deeper you need to install at least single user database.
Single User Mode
If you are planning to use SambaPOS on a single computer you can install SQLServer Compact Edition 4.0. This is a very lightweight single user database and all functions will work properly. If you don’t change default SambaPOS installation settings setup application will download and setup SQLServer CE 4.0 automatically. Database installation and configuration is very easy but if you are planning to add more terminals in the near future you can consider installing multi user database because upgrading from SQL Server CE needs database migration.
Multi User Mode
You can use both free SQL Server Express or SQL Server. This is what you need if you are planning to use multiple terminals.
We need to tell SambaPOS how it connects to database. To be able to do this we need to enter Data Connection String from Management > Local Settings
Leaving Data Connection String Empty
When database connection string is empty SambaPOS does this.
- Checks if SQL Server CE 4.0 is installed. If installed it automatically generates database file under [MyDocuments]\SambaPOS4\SambaPOS4.sdf
- If SQL Server CE 4.0 not installed is switches to TXT file mode. In this mode you can evaluate basic SambaPOS functions but switching to single or multi user mode is highly recommended.
Determining Database Mode
Double Click SambaPOS Logo to switch to window mode and check window title. At the end of the version number you’ll see one of these three suffixes.
- TX: Text File Mode
- CE: Single User Mode (SQL Server CE 4.0 is working)
- SQ: Multi User Mode (SQL Server working)
Entering SDF File Name
SQL Server CE 4.0 stores data in a single file. These files ends with *.sdf extension. If you enter a file name with sdf extension and without a path, SambaPOS checks [MyDocuments]\SambaPOS4 folder for file.
On this configuration SambaPOS will search for [MyDocuments]\SambaPOS4\test.sdf file. If it can find it uses this database. If there is no test.sdf file it autogenerates it and fills with default data.
If you need to enter full path name you can configure connection string as :
Data Source = c:\sample location\data.sdf
SQL Server Configuration
After installing SQL Server you can configure connection easily by clicking […] button located at the end of the editor. It should popup a configuration editor like this.
- Data Source: You need to enter your SQL Server instance name here. There are three cases.
- If you do not change settings during SQL Server installation it should be [Your Server Name]\SQLEXPRESS. For example if your server name is MainServer, SQL Server Name should be MainServer\SQLEXPRESS.
- If you’ve changed instance name during installation the server name should be [Server Name][Instance Name]. For example if you change instance name to SQLSERVER during setup and your Server Name is MainServer, the name should be MainServer\SQLSERVER.
- During SQL Server setup you can choose installing SQL server as default instance. If you did so you don’t need to specify an instance name. You need to only enter Server Computer Name here.
- User Id: You’ll enter your SQL Server User Name here.
- Password: Enter your password. You configured user name and password during SQL Server installation.
- Database: This is optional. By default (if left blank) SQL Server database name will be SambaPOS4. If you want to use different name you can change this setting.
When you confirm your settings you should see resulting database connection string.