diff --git a/src/interfaces/jdbc/CHANGELOG b/src/interfaces/jdbc/CHANGELOG
index 23b07a3fbe6934b95b0ad617e1b8b3dbe83aa289..347cce5f941dfeccf7704cf9aae8260ba704f724 100644
--- a/src/interfaces/jdbc/CHANGELOG
+++ b/src/interfaces/jdbc/CHANGELOG
@@ -1,3 +1,11 @@
+Tue Jun 06 12:00:00 BST 2000 petermount@it.maidstone.gov.uk
+	- Added org/postgresql/DriverClass.java to the list of files removed
+	  by make clean (it's dynamically built)
+	- Fixed Statement, so that the update count is valid when an SQL
+	  DELETE operation is done.
+	- While fixing the update count, made it easier to get the OID of
+	  the last insert as well. Example is in example/basic.java
+
 Tue Jun 06 08:37:00 BST 2000 petermount@it.maidstone.gov.uk
 	- Removed a hardwired 8K limit on query strings
 	- Added some missing org.'s in Connection that prevented
diff --git a/src/interfaces/jdbc/Makefile b/src/interfaces/jdbc/Makefile
index ce3030b4e9d40ab5d95abd159e2b51fb8ddaa7f3..efd71fc2317244ed42130350c879a1ab92391cf8 100644
--- a/src/interfaces/jdbc/Makefile
+++ b/src/interfaces/jdbc/Makefile
@@ -4,7 +4,7 @@
 #    Makefile for Java JDBC interface
 #
 # IDENTIFICATION
-#    $Id: Makefile,v 1.22 2000/05/15 21:32:51 peter Exp $
+#    $Id: Makefile,v 1.23 2000/06/06 11:05:56 peter Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -181,7 +181,7 @@ clean:
 	$(FIND) . -name "*.class" -exec $(RM) {} \;
 	$(FIND) . -name "*.html" -exec $(RM) {} \;
 	-$(RM) -rf stock example/corba/stock.built
-	-$(RM) postgresql.jar
+	-$(RM) postgresql.jar org/postgresql/DriverClass.java
 	-$(RM) -rf Package-postgresql *output
 
 #######################################################################
diff --git a/src/interfaces/jdbc/example/basic.java b/src/interfaces/jdbc/example/basic.java
index 326c49c0f17e48665c7f89aba406f48418ec4fef..41302200ec16e43a736e34feb6bf2a152895cae5 100644
--- a/src/interfaces/jdbc/example/basic.java
+++ b/src/interfaces/jdbc/example/basic.java
@@ -6,7 +6,7 @@ import java.text.*;
 
 /**
  *
- * $Id: basic.java,v 1.4 2000/04/26 05:32:00 peter Exp $
+ * $Id: basic.java,v 1.5 2000/06/06 11:05:57 peter Exp $
  *
  * This example tests the basic components of the JDBC driver, and shows
  * how even the simplest of queries can be implemented.
@@ -83,10 +83,19 @@ public class basic
     st.executeUpdate("insert into basic values (2,1)");
     st.executeUpdate("insert into basic values (3,1)");
     
+    // This shows how to get the oid of a just inserted row
+    st.executeUpdate("insert into basic values (4,1)");
+    int insertedOID = ((org.postgresql.ResultSet)st.getResultSet()).getInsertedOID();
+    System.out.println("Inserted row with oid "+insertedOID);
+    
     // Now change the value of b from 1 to 8
     st.executeUpdate("update basic set b=8");
     System.out.println("Updated "+st.getUpdateCount()+" rows");
     
+    // Now delete 2 rows
+    st.executeUpdate("delete from basic where a<3");
+    System.out.println("deleted "+st.getUpdateCount()+" rows");
+    
     // For large inserts, a PreparedStatement is more efficient, because it
     // supports the idea of precompiling the SQL statement, and to store
     // directly, a Java object into any column. PostgreSQL doesnt support
diff --git a/src/interfaces/jdbc/org/postgresql/Connection.java b/src/interfaces/jdbc/org/postgresql/Connection.java
index e205206d4567a72eaf691a026b6ef30f390badb7..539faecd3e01aa0dd16d2421d54613bfa12f2ca1 100644
--- a/src/interfaces/jdbc/org/postgresql/Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/Connection.java
@@ -10,7 +10,7 @@ import org.postgresql.largeobject.*;
 import org.postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.3 2000/06/06 07:45:07 peter Exp $
+ * $Id: Connection.java,v 1.4 2000/06/06 11:05:59 peter Exp $
  *
  * This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
  * JDBC2 versions of the Connection class.
@@ -317,7 +317,8 @@ public abstract class Connection
 	    int fqp = 0;
 	    boolean hfr = false;
 	    String recv_status = null, msg;
-		int update_count = 1;
+	    int update_count = 1;
+	    int insert_oid = 0;
 	    SQLException final_error = null;
 	    
 	    // Commented out as the backend can now handle queries
@@ -359,12 +360,19 @@ public abstract class Connection
 			    recv_status = pg_stream.ReceiveString(8192);
 				
 				// Now handle the update count correctly.
-				if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE")) {
+				if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE") || recv_status.startsWith("DELETE")) {
 					try {
 						update_count = Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' ')));
 					} catch(NumberFormatException nfe) {
 						throw new PSQLException("postgresql.con.fathom",recv_status);
 					}
+					if(recv_status.startsWith("INSERT")) {
+					    try {
+						insert_oid = Integer.parseInt(recv_status.substring(1+recv_status.indexOf(' '),recv_status.lastIndexOf(' ')));
+					    } catch(NumberFormatException nfe) {
+						throw new PSQLException("postgresql.con.fathom",recv_status);
+					    }
+					}
 				}
 			    if (fields != null)
 				hfr = true;
@@ -425,7 +433,7 @@ public abstract class Connection
 	    if (final_error != null)
 		throw final_error;
 		
-	    return getResultSet(this, fields, tuples, recv_status, update_count);
+	    return getResultSet(this, fields, tuples, recv_status, update_count, insert_oid);
 	}
     }
 
@@ -727,7 +735,7 @@ public abstract class Connection
      * This returns a resultset. It must be overridden, so that the correct
      * version (from jdbc1 or jdbc2) are returned.
      */
-    protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException;
+    protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException;
     
     public abstract void close() throws SQLException;
 	
diff --git a/src/interfaces/jdbc/org/postgresql/ResultSet.java b/src/interfaces/jdbc/org/postgresql/ResultSet.java
index e601e239ebab3e0c3e8b854d52e62813fa5a90ed..cec62614ca48ab4c95cf4a0421d8ca88569c541c 100644
--- a/src/interfaces/jdbc/org/postgresql/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/ResultSet.java
@@ -19,6 +19,7 @@ public abstract class ResultSet
   protected Field fields[];		// The field descriptions
   protected String status;		// Status of the result
   protected int updateCount;		// How many rows did we get back?
+  protected int insertOID;		// The oid of an inserted row
   protected int current_row;		// Our pointer to where we are at
   protected byte[][] this_row;		// the current row result
   protected Connection connection;	// the connection which we returned from
@@ -40,17 +41,35 @@ public abstract class ResultSet
    * @param updateCount the number of rows affected by the operation
    * @param cursor the positioned update/delete cursor name
    */
-  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
+  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID)
   {
     this.connection = conn;
     this.fields = fields;
     this.rows = tuples;
     this.status = status;
     this.updateCount = updateCount;
+    this.insertOID = insertOID;
     this.this_row = null;
     this.current_row = -1;
   }
     
+  
+  /**
+   * Create a new ResultSet - Note that we create ResultSets to
+   * represent the results of everything.
+   *
+   * @param fields an array of Field objects (basically, the
+   *	ResultSet MetaData)
+   * @param tuples Vector of the actual data
+   * @param status the status string returned from the back end
+   * @param updateCount the number of rows affected by the operation
+   * @param cursor the positioned update/delete cursor name
+   */
+  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
+  {
+      this(conn,fields,tuples,status,updateCount,0);
+  }
+    
   /**
    * We at times need to know if the resultSet we are working
    * with is the result of an UPDATE, DELETE or INSERT (in which
@@ -148,6 +167,14 @@ public abstract class ResultSet
      return fields[field-1].getOID();
    }
   
+    /**
+     * returns the OID of the last inserted row
+     */
+    public int getInsertedOID()
+    {
+	return insertOID;
+    }
+    
     /**
      * This is part of the JDBC API, but is required by org.postgresql.Field
      */
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java
index d178fa74ad92d49ab010f30f4fad1367dc82f1db..f26057b52b302a430a7d009a5a4b666968c8bf2c 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java
@@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
 import org.postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.1 2000/04/17 20:07:48 peter Exp $
+ * $Id: Connection.java,v 1.2 2000/06/06 11:06:04 peter Exp $
  *
  * A Connection represents a session with a specific database.  Within the
  * context of a Connection, SQL statements are executed and results are
@@ -378,9 +378,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
      * This overides the method in org.postgresql.Connection and returns a
      * ResultSet.
      */
-    protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
+    protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException
     {
-	return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount);
+	return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount,insertOID);
     }
     
 }
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
index 9ca67ad8b451078402240dc2452c352f890a99cf..497e401bde828776c4e9fe468c80bf5ab1d781bc 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
@@ -58,6 +58,22 @@ import org.postgresql.util.*;
  */
 public class ResultSet extends org.postgresql.ResultSet implements java.sql.ResultSet 
 {
+  /**
+   * Create a new ResultSet - Note that we create ResultSets to
+   * represent the results of everything.
+   *
+   * @param fields an array of Field objects (basically, the
+   *	ResultSet MetaData)
+   * @param tuples Vector of the actual data
+   * @param status the status string returned from the back end
+   * @param updateCount the number of rows affected by the operation
+   * @param cursor the positioned update/delete cursor name
+   */
+  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID)
+  {
+      super(conn,fields,tuples,status,updateCount,insertOID);
+  }
+  
   /**
    * Create a new ResultSet - Note that we create ResultSets to
    * represent the results of everything.
@@ -71,7 +87,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
    */
   public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
   {
-      super(conn,fields,tuples,status,updateCount);
+      super(conn,fields,tuples,status,updateCount,0);
   }
   
   /**
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java
index 62b3f6f4459f43375b54eebdf25548711f540d36..43e7ee992d23140529ff2393414b579bfc7b4567 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java
@@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
 import org.postgresql.util.*;
 
 /**
- * $Id: Connection.java,v 1.1 2000/04/17 20:07:50 peter Exp $
+ * $Id: Connection.java,v 1.2 2000/06/06 11:06:09 peter Exp $
  *
  * A Connection represents a session with a specific database.  Within the
  * context of a Connection, SQL statements are executed and results are
@@ -378,9 +378,9 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
      * This overides the method in org.postgresql.Connection and returns a
      * ResultSet.
      */
-    protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
+    protected java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount, int insertOID) throws SQLException
     {
-	return new org.postgresql.jdbc2.ResultSet((org.postgresql.jdbc2.Connection)conn,fields,tuples,status,updateCount);
+	return new org.postgresql.jdbc2.ResultSet((org.postgresql.jdbc2.Connection)conn,fields,tuples,status,updateCount,insertOID);
     }
     
     // *****************
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
index 9020e539853ae2b5dfd991dff8c500eea8536d23..bcde5043b725c7e9f092107da4e43a073f1b5f38 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
@@ -70,11 +70,27 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
    * @param updateCount the number of rows affected by the operation
    * @param cursor the positioned update/delete cursor name
    */
-  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
+  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID)
   {
-      super(conn,fields,tuples,status,updateCount);
+      super(conn,fields,tuples,status,updateCount,insertOID);
   }
   
+  /**
+   * Create a new ResultSet - Note that we create ResultSets to
+   * represent the results of everything.
+   *
+   * @param fields an array of Field objects (basically, the
+   *	ResultSet MetaData)
+   * @param tuples Vector of the actual data
+   * @param status the status string returned from the back end
+   * @param updateCount the number of rows affected by the operation
+   * @param cursor the positioned update/delete cursor name
+   */
+  public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
+  {
+      super(conn,fields,tuples,status,updateCount,0);
+  }
+    
   /**
    * A ResultSet is initially positioned before its first row,
    * the first call to next makes the first row the current row;
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
index b96041c7268052558de5f9e7dd964c29fc2869ef..1da970fa88ca675db8c29bdf5941e0c8f21c3f93 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java
@@ -417,5 +417,4 @@ public class Statement implements java.sql.Statement
 	throw org.postgresql.Driver.notImplemented();
     }
     
-    
 }