Thread: ECPG ERROR FOR "exec sql BEGIN"
<br /><font face="Geneva">I have used ECPG in my program.<br /><br /> but run "exec sql BEGIN" after connect, have a errormessage like:<br /></font><br /> "sql error BEGIN: already a transaction in progress"<br /><br /><br /> the source islike:<br /><br /> -------------<br /> exec sql connect to unix:postgresql://localhost/dbname user postgres;<br /> execsql BEGIN;<br /><br /> exec sql INSERT INTO .......<br /><br /> exec sql COMMIT;<br /> exec sql disconnect;<br /> -------------<br/><br /> Help me. Thanks very much<br />
On Fri, Nov 30, 2001 at 09:59:28PM +0900, chengong@kobundo.ne.jp wrote: > I have used ECPG in my program. > > but run "exec sql BEGIN" after connect, have a error message like: > > "sql error BEGIN: already a transaction in progress" That means you run in auto-transaction mode which is the default. Please use "ecpg -t" to compile your program if you want to start the transactions yourself. The default is that there is always an open transaction. Michael -- Michael Meskes Michael@Fam-Meskes.De Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
Michael Meskes wrote: > On Fri, Nov 30, 2001 at 09:59:28PM +0900, chengong@kobundo.ne.jp wrote: > > I have used ECPG in my program. > > > > but run "exec sql BEGIN" after connect, have a error message like: > > > > "sql error BEGIN: already a transaction in progress" > > That means you run in auto-transaction mode which is the default. Please use > "ecpg -t" to compile your program if you want to start the transactions > yourself. > > The default is that there is always an open transaction. IIRC an alternative is to issue 'exec sql set autocommit to on' after connecting. Christof
On Mon, Dec 10, 2001 at 01:41:56PM +0100, Christof Petig wrote: > > The default is that there is always an open transaction. > > IIRC an alternative is to issue 'exec sql set autocommit to on' after > connecting. Yes, that's correct. Michael -- Michael Meskes Michael@Fam-Meskes.De Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!