Setting autocommit false fails

Good Morning

I am trying to set autocommit to false, but this fails. Any help is appreciated.

Dim locCon as Object
Sub Main2
	openLocal("new_local_base")
	makeData
	closeDBObject(locCon)
End Sub

Public Sub openLocal(db$)
	locCon = getFBConnection(db)
End Sub
Private Function getFBConnection(context$)
Dim DatabaseContext As Object
	DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
	DataSource = DatabaseContext.getByName(context)
	getFBConnection= DataSource.getConnection("","")
End Function


Sub makeData
Dim ub As Long
  strSQL = "INSERT INTO TABLE1(F1) VALUES(?)"
  locCon.setAutoCommit(false)
  stmt = locCon.prepareStatement(strSQL)	
	For ub=0 To basis
		stmt.setInt(1,ub)
	Next ub
End Sub
private Sub closeDBObject(dbObject As Object)
	dbObject.close()
	dbObject = Nothing
End Sub
1 Like

Hello,

Have you found a solution ? I’m asking because I have the same issue.

Regards.

1 Like

Try DataSource.getIsolatedConnection("", “”)

1 Like

Thank you for your reply. Note that I’m not the OP :slight_smile:

The AutoCommit remains True though.

I’m using Postgres and use this code in a Calc macro.

Here’s what I have when I watch the connection.

As far as I understand, the default PostgreSql driver does not support setAutoCommit and getAutoCommit methods.

2 Likes

sorry but autcommit is still true

I can accept that answer.