table lock

Has anyone ever tried to use mysql's lock to manage concurrency in JSC? In my web application I need to prevent errors due to concurrency, is there any way to solve the problem?How can I implement lock with JSC?Thanks in advance
[250 byte] By [gio_mori] at [2007-11-26 11:56:15]
# 1

I'm not an expert in MySql. But as I read from the document, you can use pure SQL to lock the table. When the table is locked, you get errors if another thread tries to write to it.

Here is the suggestion. The rowset associated with any dataprovider has a command property. This command propoerty takes any valid SQL statement.

You could try the following.

- Get the original command and put it in a temporary variable

- Set new command (SQL) that locks the table and execute the rowset

- Execute the dataprovider commit (sets Update SQL to cached rowset)

- Set new command that unlocks the table to rowset and execute

- Set back the saved command back to the rowset

I haven't tried this, but worth trying

- Winston

http://blogs.sun.com/winston

wjprakash at 2007-7-7 12:15:29 > top of Java-index,Development Tools,Java Tools...