@@ -192,6 +192,9 @@ public void actionPerformed(ActionEvent e) {
192192// Create a statement
193193stat =db .createStatement ();
194194
195+ // Set the connection to use transactions
196+ db .setAutoCommit (false );
197+
195198// Also, get the LargeObjectManager for this connection
196199lom = ((postgresql .Connection )db ).getLargeObjectAPI ();
197200
@@ -209,6 +212,7 @@ public void init()
209212try {
210213stat .executeUpdate ("create table images (imgname name,imgoid oid)" );
211214label .setText ("Initialised database" );
215+ db .commit ();
212216 }catch (SQLException ex ) {
213217label .setText (ex .toString ());
214218 }
@@ -310,6 +314,7 @@ public void run() {
310314// our own thread
311315stat =db .createStatement ();
312316stat .executeUpdate ("insert into images values ('" +name +"'," +oid +")" );
317+ db .commit ();
313318
314319// Finally refresh the names list, and display the current image
315320ImageViewer .this .refreshList ();
@@ -372,9 +377,11 @@ public void removeImage()
372377
373378// Finally delete any entries for that name
374379stat .executeUpdate ("delete from images where imgname='" +currentImage +"'" );
380+ db .commit ();
375381
376382label .setText (currentImage +" deleted" );
377383currentImage =null ;
384+ db .commit ();
378385refreshList ();
379386 }catch (SQLException ex ) {
380387label .setText (ex .toString ());