# record\_locking not work fine

**URL:** <https://forum.servoy.com/t/record-locking-not-work-fine/16596>\
**Category:** Classic Servoy\
**Created:** [October 4, 2012, 4:05pm UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596 "2012-10-04T16:05:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pentamsi](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pentamsi](https://forum.servoy.com/u/pentamsi)\
**Post date:** [October 4, 2012, 4:05pm UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596/1 "2012-10-04T16:05:09Z")

</div>

Hello, i have a problem with the **Record locking** option. I check the option in the program **qcinst\_unidades**

[![](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/8/819a4975ac46546e9798bc985181338a057bf52c.png)](http://imgur.com/7gazw)

And after, i try to edit the same at the same time of other user, but in the code of the function inside of **dc\_edit** , in the **svy\_nab\_base** in line **#509**

```auto
if (globals.nav.program[_program].record_locking) {

		if (controller.view != 0) //list or table view, so lock more records
		{
			_success = databaseManager.acquireLock(foundset, -1, _program)
			if (!_success) {
				globals.DIALOGS.showWarningDialog(i18n.getI18NMessage('svy.fr.lbl.warning'), i18n.getI18NMessage('svy.fr.dlg.record_lock'), i18n.getI18NMessage('svy.fr.lbl.ok'));
				return;
			}

		} else {
			_success = databaseManager.acquireLock(foundset, 0)
			if (!_success) {
				globals.DIALOGS.showWarningDialog(i18n.getI18NMessage('svy.fr.lbl.warning'), i18n.getI18NMessage('svy.fr.dlg.record_lock'), i18n.getI18NMessage('svy.fr.lbl.ok'));
				return;
			}

		}
	}

```

But when arrive to this point:

```auto
_success = databaseManager.acquireLock(foundset, 0)

```

Allways return true, and never return false, instead of other user different of me, editing the record.

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [October 5, 2012, 8:05am UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596/2 "2012-10-05T08:05:42Z")

</div>

pentamsi,

databaseManager.acquireLock(foundset, 0) locks the currently selected record in the foundset.  
Are you sure the selection in both clients is the same, do they lock the same record?

Rob

---

<div class="post-metadata">

**Author:** ![pentamsi](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pentamsi](https://forum.servoy.com/u/pentamsi)\
**Post date:** [October 5, 2012, 8:09am UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596/3 "2012-10-05T08:09:57Z")

</div>

Yes, I’m 100% sure. Both clients are connected to the same database, but the solution not is allowed in a servoy server, everyone run in his own machine and connect to the same database, this maybe a problem? but i understand if the database is the same, there not have to be a problem, no?

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [October 5, 2012, 8:36am UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596/4 "2012-10-05T08:36:22Z")

</div>

So you have multiple ApplicationServers running against the same database?

Record locking is managed within the appserver, it works between clients connected to the same appserver.  
Servoy does not expect to share between appservers, so also other things, like databroadcast also does not work over multiple appservers.

We have some support to share state and db-level locking between appservers, but you would need to configure this.

Why do you need separate appservers?

Rob

---

<div class="post-metadata">

**Author:** ![pentamsi](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pentamsi](https://forum.servoy.com/u/pentamsi)\
**Post date:** [October 5, 2012, 8:46am UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596/5 "2012-10-05T08:46:45Z")

</div>

No, for the final client all users connect to the same appserv, but when we are developing, every developer have her own servoy in local, and all connect to the same database. But now i’m trying to make a connection with the server, but show me this error.

[![](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/6/64315bfd630c23986021bb1f2e81d648c000ca30.png)](http://imgur.com/an9CF)

Any idea?

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [October 8, 2012, 8:56am UTC](https://forum.servoy.com/t/record-locking-not-work-fine/16596/6 "2012-10-08T08:56:36Z")

</div>

Servoy developer starts it’s own application server in the background, so you can’t test record locking between developers.

What you can do to test it, is start a smart client and a webclient, then you should not be able to edit the same record.
