# Table Locking in Insert Command.

**URL:** <https://community.unix.com/t/table-locking-in-insert-command/328392>\
**Category:** Programming\
**Created:** [May 13, 2013, 6:01am UTC](https://community.unix.com/t/table-locking-in-insert-command/328392 "2013-05-13T06:01:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![senkerth](https://community.unix.com/letter_avatar/senkerth/32/6_449c533f586939b6e5f246632a46421f.png) [@senkerth](https://community.unix.com/u/senkerth)\
**Post date:** [May 13, 2013, 6:01am UTC](https://community.unix.com/t/table-locking-in-insert-command/328392/1 "2013-05-13T06:01:27Z")

</div>

Hi,

i have a java based tool which does insert operation in a TABLE, and in parallel the same table is used by my C++ code which does select Query.

the Table will be always busy, but sometimes the table is getting locked when i try to make an insert, am bit confused whether the lock is because of SELECT query from my C++ code or by the INSERT QUERY from the java Tool.

Do i need to modify the Query if so how..? and from the google i learnt that select puts an internal LOCK.

currently am locking the table before insert below is my query

lock table table\_name in exclusive mode nowait

and giving a commit after performing the DML operation so that lock will be removed automatically.

can anyone please solve my query.?

thanks,  
senthil
