[answered]Database questions

Continuing the discussion from Can 2 different user run 2 database on Smabapos at a time:

Continuing the discussion from Re-open Settled Ticket & Cancel Payments:

What is your question? You shouldn’t just continue a discussion and not ask anything. Please don’t make us read long discussions and try to guess what you need.

I am trying to use Samba for two different businesses at the same restaurant.
So I installed a copy on an external hard drive for my sons part.

when I open up the external hard drive copy it duplicates the one I have for my daytime business.
I am not computer savvy. I even bought separate modules in the marketplace.

Can someone tell me what I am doing wrong and how I can separate the two?

Thank you,
Paula

I am sorry I was just typing it kendash.

Just go to local settings and database setup and keep everything the same but put new database name the save and restart samba. You can switch between the two databases by using an action for change database string and a button.

2 Likes

thank you, I will try that.

BTW, do you have SQL server express?

Do you use same computers to operate both businesses?

Another way is use 1 database but create another department for your son business.

no, I don’t think so. my database says [DB:78-78] SQ. I am still trying to figure out where the database is located to understand kendashs’ instructions,

thanks,
paula

If your using SQL the database will be in the SQL program folder I believe. However you would not do anything with the database files, you would change the database string in samba and samba would create the second database in the SQL instance already there.if your running SQL opening and connecting SQL manager might help you visualise what is being said.

When I get home I’ll post screenshot tutorial.

2 Likes

that is very kind of you.

thank you
Paula

I am back give me a bit to prepare something.

This is done in v5 but its also possible in v4 the difference may be that in v4 you wont have Apply button next to Edit Connection.

So you navigate to Manage > Settings > Local Settings > Database and then press the Edit Connection button. Do not mess with anything except for Database you can define a new 2nd database name here and then press ok and save then restart sambapos. This will cause SambaPOS to make a new database with the name you defined.

You simply do the same thing again but enter your previous database name to switch back to your original database. Next I will show you how to setup a button that switches databases for you. That tutorial is coming up shortly…

1 Like

Step 1: Create a Change Database Connection action:

Step 2: Create an Automation Command call it Switch Database:

Map it to Ticket:

Step 3: Create an Automation Command Executed rule:

You need to setup the following for Connection String inside the Switch Databases action:

Data Source=mancow2\SQLexpress; Database=[?Enter Database Name]

Where it says Data Source=mancow2\SQLexpress this should be your connection string mancow2\SQLexpress is mine. the Database=[?Enter Database Name] prompts for you to type the database name you want to switch to.

Remember you should spell it exact or it will simply create a new one with the new name :stuck_out_tongue:

Finally this setup must be replicated on both databases so you have the same button on both.

1 Like

BTW you might want to add Logout Action after the Switch Databases action in your rule. You may not see the switch until you logout.

EDIT: @emre Interesting it might be v5 only issue but Logout User doesnt seem to work however it is switching database if I reset Cache it has switched without logging out. This is somewhat interesting but it causes some funky things until I do logout and back in.

hello

thank you for all that work. Here is a screenshot of my program settings screen. It looks a bit different.
Paula

You are using local database. I think local database can only serve one terminal/computer.

So, do you use same computer for both businesses?

You have to use same database if you use same computer. Just create another department for your son.

No it will work fine for local database as well. Let me get the connection string one second. BTW you can just use the action and rule and button setup you dont have to go into your database settings. I just showed that as example for manually doing it.

PS this button is same as Edit Database button from v5.

Let me get connection string you need to use… one moment.

Ok it would be DataSource=(localdb)\MSSQLLocalDB; Database=Your Database Name;

So in the rule that has the switch database action use this for Connection String parameter:

DataSource=(localdb)\MSSQLLocalDB; Database=[?Enter Database Name];

Before you run it however you need to figure out what your local db name is. I think default its SambaPOS4 let me check though.

Probably you have to show her how to create another database as well :wink:

No because SambaPOS does it for you. All you need to do is specify a name.

Wow Ask parameter work here too!

1 Like