Thread: insert blocking?
Hi, i use a prepared statement to insert a new record. Is it possible that an insert blocks? In other words can the myInsertStmt.executeUpdate() call block? thanks Haug
Haug, you will need to execute the insert within a transaction to get the insert to block ie: con.setAutoCommit(false) execute("begin; lock table") executeUpdate("insert ...." con.commit() Dave On Mon, 2002-05-13 at 05:36, Haug Bürger wrote: > Hi, > > i use a prepared statement to insert a new record. Is it possible > that an insert blocks? In other words can the > myInsertStmt.executeUpdate() call block? > > thanks > Haug > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > >
Hi Dave, from your answer i get the impression that PostgreSQL uses record locking by default. Do you know how to find out how the DB is configured? Thanks Haug Dave Cramer wrote: >Haug, > >you will need to execute the insert within a transaction to get the >insert to block > >ie: >con.setAutoCommit(false) >execute("begin; ___lock table___") >executeUpdate("insert ...." >con.commit() > >Dave >
Hi Haug, I didn't mean to give that impression. record locking is not on by default. It is the jdbc driver that has autocommit on by default. This still doesn't change the fact that you have to do a locked insert within a transaction. Dave On Wed, 2002-05-15 at 02:39, Haug Bürger wrote: > Hi Dave, > > from your answer i get the impression that PostgreSQL uses record > locking by default. > Do you know how to find out how the DB is configured? > > Thanks > Haug > > > Dave Cramer wrote: > > >Haug, > > > >you will need to execute the insert within a transaction to get the > >insert to block > > > >ie: > >con.setAutoCommit(false) > >execute("begin; ___lock table___") > >executeUpdate("insert ...." > >con.commit() > > > >Dave > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > >