SambaPOS Database Configuration

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.

Introduction

SambaPOS can work in three database modes. Demo mode, single user mode and multi user mode.

Demo 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.

Step by Step SQL Server Express installation for SambaPOS.

Configuration

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.

  1. Checks if SQL Server CE 4.0 is installed. If installed it automatically generates database file under [MyDocuments]\SambaPOS4\SambaPOS4.sdf
  2. 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.

4 Likes

in the client-PC do i need to install SQLEXPRESS too ? to make connection the client-PC to server-PC ?

No, you won’t install SQL Server Express on clients. .Net Framework already contains client connectivity libraries. You only need to configure SambaPOS Data Connection String on clients.

well, at the beginning i had a problem with SambaPOS4 installation and the SQLExpress in the main server, the connection string doesnt start (message server not connected) but i already found the problem and fix it and message server is “connected”. after i make sure give correct installation in the main server-PC i start to install it on the client-PC, but now i had a problem in the client-PC event i already giving the correct Data connection string on client…

Message Server has no relation with database connection. It updates client table screens for new / paid tickets. If it is not connected your client does not update table screen on new tickets but database will work fine.

First of all be sure your sql server instance name is SAMBAPOS4 or not. If you didn’t intentionally changed it to SAMBAPOS4 during SQL Server installation it should be SQLEXPRESS. So your datasource should be named as DARATECH-PC\SQLEXPRESS. I’m assuming your server name is DARATECH-PC.

Check server firewall settings to be ensure it permits client connections.

Check TCP-IP ports enabled on server as it shown on the installation documentation.

1 Like

i have the same problem and found the problem is…
here what i did (hope can help u too) @Jtattersall and for @emre i hope your not mind i make a note at once in case i forgot so i just open this forum again…

  1. install sambaPOS4 after finish than install SQL Express 2012
  2. follow instruction SambaPOS Database Configuration
  3. After that (1) open the file sambapos4 where you locate, the default is C:\Program Files\SambaPOS4 and (2) click Samba.MessagingServerServiceTool, (3) chance the port i use 8080 port, (4) click update port, (5) click start (if hasnt start yet)
  4. make sure Samba Messaging Server is auto start by check on Control Panel\All Control Panel Items\Administrative Tools\services and find “samba pos 4 messaging server” so when you restart the PC will auto run, so you can simply click and run the sambaPOS4

  1. last thing what i did is open again sql server configuration manager and chance the TCP/IP port for client manager

    and now i can run sambaPOS4 from client-PC
1 Like

Great! One important point is you don’t need to run both MessagingServer.exe and messaging server service that you start with the messaging server service tool. If you start messaging server service with the tool it should work without starting messagingServer.exe.

yes you’re right and one more…on client-PC dont need to configure the message server…
once again thank you @emre and now i need to configure other thing with sambaPOS4

Im trying all tutorials including this one, also running @JohnS script for converting sdf to express 2012 DB -
cant manage to run sambapos with express 2012
(im testing it on my windows 8.1)

sorry for luck of details - its been 4 hours i spend on nada

im doin a test convertion before i’ll istall it on my running machine

@mayase, it should work under Windows 8.1 if all the steps are followed carefully, I have configured without any issues.

I did exacly step by step, i"ll try tomorow again on win 7

OK i finally managed to run all well and a green “Connected” (still trying on my windows 8.1), but i had to do some workarounds:
at first, i managed to run it as SQ mode but no message server connection so for that i stopped all services and manually run “Samba.MessagingServer.exe” (im putting it in windows startup) - i still dont understand how this should automatically work - is sambapos suppose to start it or i should do it manually - how this should be configures in its best? whats the difference between “Samba.MessagingServer.exe” “Samba.MessagingServer.WindowsService.exe” and “Samba.MessagingServerServiceTool.exe”
how sambapos* windows services should be configured?
etc.

the second problem i had was no integration/import from my SambaPOS4.sdf to my “MAYA-LAPTOP\SAMBAPOS4” SQL Express 2012 database. i used “Import_sql.bat” script: the script didnt create SambaPOS4.sql file - it split to 2 files SambaPOS4_0.sql and SambaPOS4_1.sql (my SambaPOS4.sdf file is 13,588kb), so i had to run each manually,
the second issue with the scrip was that the first part i had to run normal, and the second part i had to “Run as administrator” (from the part of “Changing SambaSettings.txt file to connect…”)
*running the first part as administrator - made some errors…

but whatever!, everything now WORKS!

@mayase, Message Server configuration is explained in detailed in following:

Thanks @morshed1 i missed that tutorial

Conversion from CE to SQL is never easy, which is why we keep saying setup SQL from the start.
Now that SambaPOS has Local SQL available during installation, it is very easy to move to SQL Express if needed.

HI, My database is working fine in server computer and rdp (tablets ) working fine, it is updating orders in server pos, BUT my problem is i have installed sambapos in another computer is same network and connected to work group.
it is keep on giving me connection string error, now i cant use sambapos in that new computer(terminal computer), I tried uninstall software and install again giving me same error message.

Do I have to install SQL server 2012 again in client or terminal computer ?
please help me with a solution , i have gone through all related discussion but couldn’t find a solution.
Thanks All.

Turn off windows firewall on the main computer.
You do not need to install SQL Server on any other computers.
Your connection string should be identical to the main computer.

Hi @JohnS
-firewall is off
-string is exactly the same,
-tried adding port number
no luck,

http://sambapos.org/wiki/doku.php/en/installing_sql_express_2012_for_sambapos_v3

Have you checked the settings in Section - 3. Enabling Network Services

Not being able to connect over the network is usually a Network Services issue with SQL Server, or you have not setup Mixed Mode authentication when you created the SAMAPOS3 instance.
See here http://support.microsoft.com/kb/555332

PS - Port number will make no difference on a local network.